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: If "_REENTRANT" is defined in the header file, we should use "-D_REENTRANT" when compiling
Type: Stage: resolved
Components: Build Versions: Python 3.9, Python 3.8, Python 3.7, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jcea Nosy List: jcea
Priority: high Keywords: patch

Created on 2019-09-27 21:35 by jcea, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 16446 merged jcea, 2019-09-28 00:53
PR 16449 merged miss-islington, 2019-09-28 01:45
PR 16450 merged miss-islington, 2019-09-28 01:52
PR 16452 closed jcea, 2019-09-28 02:26
PR 16454 merged jcea, 2019-09-28 02:42
Messages (5)
msg353416 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2019-09-27 21:35
When compiling on Solaris family, we define "_REENTRANT" in "Pyconfig.h".  That file is included when compiling C extensions, but if the extension is made of several C files, it could be included only in the file that interfaces with python runtime.

Unfortunately, "_REENTRANT" modifies the way C code is compiled, so compiling a C extension with some source files with "_REENTRANT" and some other without that "define" can produce bizarre errors and crashes.

One example: https://github.com/joyent/pkgsrc/issues/207

In particular, "include" order can make a big difference: https://github.com/jnwatson/py-lmdb/issues/213

I suggest that when "_REENTRANT" is defined in "Pyconfig.h", Python C extensions compilation machinery adds "-D_REENTRANT" to the compilation flags.

The patch is trivial.
msg353431 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2019-09-28 01:44
New changeset 52d1b86bde2b772a76919c76991c326384954bf1 by Jesús Cea in branch 'master':
bpo-38301: In Solaris family, we must be sure to use '-D_REENTRANT' (#16446)
https://github.com/python/cpython/commit/52d1b86bde2b772a76919c76991c326384954bf1
msg353433 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2019-09-28 02:20
New changeset 8750bce9884335d43ac06989f64473ed877c5b63 by Jesús Cea (Miss Islington (bot)) in branch '3.8':
bpo-38301: In Solaris family, we must be sure to use '-D_REENTRANT' (GH-16446) (#16449)
https://github.com/python/cpython/commit/8750bce9884335d43ac06989f64473ed877c5b63
msg353434 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2019-09-28 02:21
New changeset 6112b91bb827b07ab83e3e720aa055772a2c8b9d by Jesús Cea (Miss Islington (bot)) in branch '3.7':
bpo-38301: In Solaris family, we must be sure to use '-D_REENTRANT' (GH-16446) (#16450)
https://github.com/python/cpython/commit/6112b91bb827b07ab83e3e720aa055772a2c8b9d
msg353438 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2019-09-28 03:09
New changeset 598f676880662fb453ff98fda42b7b7068e5be32 by Jesús Cea in branch '2.7':
[2.7] bpo-38301: In Solaris family, we must be sure to use '-D_REENTRANT' (GH-16446). (#16454)
https://github.com/python/cpython/commit/598f676880662fb453ff98fda42b7b7068e5be32
History
Date User Action Args
2022-04-11 14:59:20adminsetgithub: 82482
2019-09-28 06:31:34ned.deilysetversions: - Python 3.5, Python 3.6
2019-09-28 04:39:57jceasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-09-28 03:09:27jceasetmessages: + msg353438
2019-09-28 02:42:47jceasetpull_requests: + pull_request16034
2019-09-28 02:26:35jceasetpull_requests: + pull_request16032
2019-09-28 02:21:27jceasetmessages: + msg353434
2019-09-28 02:20:34jceasetmessages: + msg353433
2019-09-28 01:52:23miss-islingtonsetpull_requests: + pull_request16030
2019-09-28 01:45:46miss-islingtonsetpull_requests: + pull_request16029
2019-09-28 01:44:35jceasetmessages: + msg353431
2019-09-28 00:53:23jceasetkeywords: + patch
stage: patch review
pull_requests: + pull_request16025
2019-09-27 21:36:31jceasettitle: If "_REENTARNT" is defined in the header file, we should use "-D_REENTRANT" when compiling -> If "_REENTRANT" is defined in the header file, we should use "-D_REENTRANT" when compiling
2019-09-27 21:35:16jceacreate