New submission from anthony shaw <anthony.p.s...@gmail.com>:
If for whatever reason, Py_Initialize() has not been run or failed to run, any call to Py_CompileStringFlags will call PyUnicode_DecodeFSDefault and the reference to interp will be NULL. There is currently no null reference check in PyUnicode_DecodeFSDefaultAndSize which causes a segfault. https://github.com/python/cpython/blob/master/Objects/unicodeobject.c#L3736-L3737 is the offending line. It might be better to catch the null pointer and raise an unrecoverable error there? Error: signal 11: 0 ceval-prof 0x00000001066310f3 handler + 35 1 libsystem_platform.dylib 0x00007fff6adddb3d _sigtramp + 29 2 ??? 0x0000000000000000 0x0 + 0 3 ceval-prof 0x0000000106734536 PyUnicode_DecodeFSDefault + 38 4 ceval-prof 0x0000000106879514 Py_CompileStringExFlags + 36 5 ceval-prof 0x0000000106631280 main + 320 6 libdyld.dylib 0x00007fff6abf2ed9 start + 1 ---------- components: Interpreter Core messages: 338521 nosy: anthony shaw priority: normal severity: normal status: open title: segfault on PyUnicode_DecodeFSDefaultAndSize for uninitialized Py versions: Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36386> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com