[New-bugs-announce] [issue29859] Return code of pthread_* in thread_pthread.h is not used for perror

Daniel Birnstiel report at bugs.python.org
Mon Mar 20 08:08:19 EDT 2017


New submission from Daniel Birnstiel:

Python/thread_pthread.h:145 defines the CHECK_STATUS macro used for printing error messages in case any of the calls fail.

CHECK_STATUS uses perror for formatting an error message, which relies on the global erno being set (see man perror). Since the pthread functions return their status code instead of setting erno (which might not even work in threaded environments), no additional information is displayed. See for example produced by PyThread_release_lock:

pthread_mutex_lock[3]: Undefined error: 0
pthread_cond_signal: Undefined error: 0
pthread_mutex_unlock[3]: Undefined error: 0

The correct solution would be to use strerror(status) in order to show the proper message.

----------
components: Interpreter Core
messages: 289884
nosy: Birne94
priority: normal
severity: normal
status: open
title: Return code of pthread_* in thread_pthread.h is not used for perror
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29859>
_______________________________________


More information about the New-bugs-announce mailing list