GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Crash with `PyGILState_Ensure` called from background thread during finalization on Python 3.14.0a7 · Issue #132948 · python/cpython Closed as duplicate Closed as duplicate Copy link Labels 3.14bugs and security fixesbugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump DescriptionCrash reportWhat happened?Coming over from work on PyO3's branch to support Python 3.14. We have a crash which can be narrowed down to calling // src/lib.rs use pyo3_ffi::*; static mut MODULE_DEF: PyModuleDef = PyModuleDef { m_base: PyModuleDef_HEAD_INIT, m_name: c"pyo3_scratch".as_ptr(), m_doc: c"Demonstration of PyGILState_Ensure crash.".as_ptr(), m_size: 0, m_methods: unsafe { METHODS as *const [PyMethodDef] as *mut PyMethodDef }, m_slots: unsafe { SLOTS as *const [PyModuleDef_Slot] as *mut PyModuleDef_Slot }, m_traverse: None, m_clear: None, m_free: None, }; static mut SLOTS: &[PyModuleDef_Slot] = &[ PyModuleDef_Slot { slot: Py_mod_gil, value: Py_MOD_GIL_NOT_USED, }, unsafe { std::mem::zeroed() }, ]; static mut METHODS: &[PyMethodDef] = &[ // A zeroed PyMethodDef to mark the end of the array. PyMethodDef::zeroed(), ]; // The module initialization function, which must be named `PyInit_<your_module>`. #[allow(non_snake_case)] #[no_mangle] pub unsafe extern "C" fn PyInit_pyo3_scratch() -> *mut PyObject { std::thread::spawn(|| { loop { // Repeatedly acquire and release the GIL; unsafe { PyGILState_Release(PyGILState_Ensure()); } } }); PyModuleDef_Init(std::ptr::addr_of_mut!(MODULE_DEF)) } # Cargo.toml [package] name = "pyo3-scratch" version = "0.1.0" edition = "2021" [lib] name = "pyo3_scratch" crate-type = ["cdylib"] [dependencies] pyo3-ffi = { version = "0.24" } # pyproject.toml [build-system] requires = ["maturin>=1,<2"] build-backend = "maturin" [project] dynamic = ["version"] name = "pyo3-scratch" requires-python = ">=3.6" [tool.maturin] features = ["pyo3-ffi/extension-module"] Reproduce by
lldb backtrace: CPython versions tested on:3.14 Operating systems tested on:macOS Output from running 'python -VV' on the command line:Python 3.14.0a7 (main, Apr 25 2025, 15:33:43) [Clang 17.0.0 (clang-1700.0.13.3)] Activity
MetadataMetadataAssigneesLabels3.14bugs and security fixesbugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump ProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |