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.

Title: crash reimporting posix after Py_Finalize on mac
Type: crash Stage: resolved
Components: Interpreter Core, macOS Versions: Python 3.9, Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Benoit Hudson, iritkatriel, miss-islington, ned.deily, ronaldoussoren, vstinner
Priority: normal Keywords: patch

Created on 2019-08-23 15:39 by Benoit Hudson, last changed 2022-04-11 14:59 by admin. This issue is now closed.

File name Uploaded Description Edit
crashy.c Benoit Hudson, 2019-08-23 15:39
Pull Requests
URL Status Linked Edit
PR 15428 merged Benoit Hudson, 2019-08-23 16:07
PR 17488 merged miss-islington, 2019-12-06 19:15
Messages (6)
msg350309 - (view) Author: Benoit Hudson (Benoit Hudson) * Date: 2019-08-23 15:39
On OSX, with --enable-shared, if you shut down python and reinitialize, you can get a crash.

Repro steps: see attached crashy.c
gcc -I. -I ../Include/ -L. crashy.c -lpython3.9

On OSX, with --enable-shared, you get a crash! On other platforms including on OSX static builds, no crash.

Not a regression: it's present in 2.7 (where we actually hit it).

PR incoming, the fix is simple. It has to do with caching (on OSX shared builds only) a stale value for the environment when building os.environ the first time; if you change the environment, the second initialization reads garbage when building os.environ.
msg354387 - (view) Author: Benoit Hudson (Benoit Hudson) * Date: 2019-10-10 15:23
Ping! The patch has been ready for review for over a month.

If the patch can be backported to 2.7.x before that gets end-of-lifed it would be ideal.
msg357940 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-12-06 19:15
New changeset 723f71abf7ab0a7be394f9f7b2daa9ecdf6fb1eb by Victor Stinner (Benoit Hudson) in branch 'master':
bpo-37931: Fix crash on OSX re-initializing os.environ (GH-15428)
msg357942 - (view) Author: miss-islington (miss-islington) Date: 2019-12-06 19:32
New changeset 836cf31a3cf468ed9598a220b8e194b366287bfe by Miss Islington (bot) in branch '3.8':
bpo-37931: Fix crash on OSX re-initializing os.environ (GH-15428)
msg378789 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2020-10-16 23:23
Can this be closed?
msg378880 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-10-18 18:02
Right, I close the issue.
Date User Action Args
2022-04-11 14:59:19adminsetgithub: 82112
2020-10-18 18:02:08vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg378880

stage: patch review -> resolved
2020-10-16 23:23:12iritkatrielsetnosy: + iritkatriel
messages: + msg378789
2019-12-06 19:32:39miss-islingtonsetnosy: + miss-islington
messages: + msg357942
2019-12-06 19:15:17miss-islingtonsetpull_requests: + pull_request16967
2019-12-06 19:15:16vstinnersetnosy: + vstinner
messages: + msg357940
2019-10-10 15:23:12Benoit Hudsonsetmessages: + msg354387
versions: + Python 2.7
2019-08-23 16:07:35Benoit Hudsonsetkeywords: + patch
stage: patch review
pull_requests: + pull_request15125
2019-08-23 15:39:47Benoit Hudsoncreate