[Python-Dev] Python initialization and embedded Python (original) (raw)
Steve Dower steve.dower at python.org
Fri Nov 17 19:17:25 EST 2017
- Previous message (by thread): [Python-Dev] Python initialization and embedded Python
- Next message (by thread): [Python-Dev] Python initialization and embedded Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 17Nov2017 1601, Victor Stinner wrote:
In short, it means that using the "Python runtime" before it's initialized by PyRuntimeInitialize() is now likely to crash. For example, calling PyMemRawMalloc(), before calling PyRuntimeInitialize(), now calls the function NULL: dereference a NULL pointer, and so immediately crash with a segmentation fault.
I'm writing this email to ask if this change is an issue or not to embedded Python and the Python C API. Is it still possible to call "all" functions of the C API before calling PyInitialize()?
I thought it was never possible to call most of the C API without initializing, except for certain APIs that are documented as being safe. I've certainly crashed many times calling C APIs before initialization. My intuition was that the only safe ones before were those that were used to initialize the runtime (Py_SetPath and such), which are also the ones being "upgraded" as part of this work.
If we have a good idea of which ones are [un]safe now, perhaps we should tag them explicitly in the docs? Do we know which ones are [un]safe?
Cheers, Steve
- Previous message (by thread): [Python-Dev] Python initialization and embedded Python
- Next message (by thread): [Python-Dev] Python initialization and embedded Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]