Closed
Description
Issue description
The Py_tss_t* internals::tstate
created in get_internals()
with PyThread_tss_create()
is never released with PyThread_tss_delete()
. This is usually not a problem, unless you happen to initialize an interpreter in a loop repeatedly. Eventually, the PyThread_tss_create()
will fail (on Windows, because TlsAlloc()
returns TLS_OUT_OF_INDEXES
), causing get_internals()
to throw an exception with the message "get_internals: could not successfully initialize the TSS key!"
.
On my machine, this happens when initializing the interpreter for the 1070th time.
Reproducible example code
while (true) {
pybind11::initialize_interpreter();
pybind11::finalize_interpreter();
}
Metadata
Metadata
Assignees
Labels
No labels