This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: pystate.c #ifdef ordering problem
Type: compile error Stage: resolved
Components: Interpreter Core Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Jim.Jewett, pitrou, python-dev
Priority: low Keywords: easy

Created on 2012-04-12 21:49 by Jim.Jewett, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (6)
msg158174 - (view) Author: Jim Jewett (Jim.Jewett) * (Python triager) Date: 2012-04-12 21:49
The C linkage is guarded by WITH_THREAD.  The 'extern "C" {' and '}' declarations should be in effect regardless of threading.

Note that the bug can only be triggered by compiling without threads, but with a C++ compiler; this is obscure enough that I don't feel strongly about backporting.
msg158176 - (view) Author: Jim Jewett (Jim.Jewett) * (Python triager) Date: 2012-04-12 21:52
http://hg.python.org/cpython/file/0f114b855824/Python/pystate.c#l25


#ifdef WITH_THREAD
#include "pythread.h"
static PyThread_type_lock head_mutex = NULL; /* Protects interp->tstate_head */
#define HEAD_INIT() (void)(head_mutex || (head_mutex = PyThread_allocate_lock()))
#define HEAD_LOCK() PyThread_acquire_lock(head_mutex, WAIT_LOCK)
#define HEAD_UNLOCK() PyThread_release_lock(head_mutex)
 
#ifdef __cplusplus
extern "C" {
#endif
msg158205 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-04-13 10:19
I don't think you need anyone's permission to commit such a fix :)
msg158209 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-04-13 15:59
New changeset 5cc359804d61 by Benjamin Peterson in branch '3.2':
take linkage def outside of WITH_THREAD conditional (closes #14569)
http://hg.python.org/cpython/rev/5cc359804d61
msg158210 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-04-13 16:00
New changeset 508ae5d27c2c by Benjamin Peterson in branch '2.7':
take linkage def outside of WITH_THREAD conditional (closes #14569)
http://hg.python.org/cpython/rev/508ae5d27c2c
msg158450 - (view) Author: Jim Jewett (Jim.Jewett) * (Python triager) Date: 2012-04-16 13:50
On Fri, Apr 13, 2012 at 6:19 AM,
Antoine Pitrou <pitrou@free.fr> added the comment:

> I don't think you need anyone's permission to commit such a fix :)

Well, *I* would, since I don't have commit privs, and don't currently
have a C dev environment with which to test.

But I figured testing the various build conditions might be good
documentation-of-ability for someone applying to GSoC or otherwise
trying to get started. (OK, the timing wouldn't be ideal, ...)

That said, I foresee adding build-multiple-ways to the regression
tests (as opposed to a buildbot), so I'll let the next applicant come
up with something else.  :D
History
Date User Action Args
2022-04-11 14:57:29adminsetgithub: 58774
2012-04-16 13:50:22Jim.Jewettsetmessages: + msg158450
2012-04-13 16:00:55python-devsetmessages: + msg158210
2012-04-13 15:59:57python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg158209

resolution: fixed
stage: needs patch -> resolved
2012-04-13 10:19:33pitrousetnosy: + pitrou
messages: + msg158205
2012-04-12 21:52:41Jim.Jewettsetpriority: normal -> low
type: compile error
messages: + msg158176

stage: needs patch
2012-04-12 21:49:06Jim.Jewettcreate