Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
Closed
Labels
3.15new features, bugs and security fixesnew features, bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-free-threadingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
#include<Python.h>staticintexamplemodule_exec(PyObject*module){// Yes I know there's no error checking...PyObject*gil_enabled=PySys_GetObject("_is_gil_enabled"); PyObject*result=PyObject_CallNoArgs(gil_enabled); printf("gil enabled: "); PyObject_Print(result, stdout, 0); printf("\n"); Py_DECREF(result); return0} staticPyModuleDef_Slotexamplemodule_slots[] ={{Py_mod_name, "examplemodule"},{Py_mod_gil, Py_MOD_GIL_USED},{Py_mod_exec, (void*)examplemodule_exec},{0} }; PyMODEXPORT_FUNCPyModExport_examplemodule(void){returnexamplemodule_slots}I believe that the code above should print "gil enabled: True". However when I run it on Python 3.15.0a2 freethreading it prints "gil enabled: False".
I don't believe this is an issue in the old style PyInit_ initialization.
CPython versions tested on:
3.15
Operating systems tested on:
Linux
Linked PRs
Metadata
Metadata
Assignees
Labels
3.15new features, bugs and security fixesnew features, bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-free-threadingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error