[issue37931] crash reimporting posix after Py_Finalize on mac

Benoit Hudson report at bugs.python.org
Fri Aug 23 11:39:47 EDT 2019


New submission from Benoit Hudson <benoit.hudson at imaginary-spaces.com>:

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
./a.out

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.

----------
components: Interpreter Core, macOS
files: crashy.c
messages: 350309
nosy: Benoit Hudson, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: crash reimporting posix after Py_Finalize on mac
type: crash
versions: Python 3.9
Added file: https://bugs.python.org/file48559/crashy.c

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37931>
_______________________________________


More information about the Python-bugs-list mailing list