[issue46673] Py_BuildValue tuple creation segfaults in python3.9..3.11

2022-02-07 Thread Olli Lupton
Olli Lupton added the comment: With apologies for the noise, I realise that the posted example does not handle the GIL correctly. -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker

[issue46673] Py_BuildValue tuple creation segfaults in python3.9..3.11

2022-02-07 Thread Olli Lupton
New submission from Olli Lupton : The following function, compiled and linked into a shared library, segfaults when called from Python: ``` #define PY_SSIZE_T_CLEAN #include extern "C" PyObject* my_func() { return Py_BuildValue("(O)", Py_None); } ``` called using ctypes: ``` from ctypes