Victor Stinner

Results 756 comments of Victor Stinner

The `threading._shutdown()` now waits until a Python thread completes at the C level: when the `thread_bootstrap()` function (previously known as `t_bootstrap()`) completes. It changed to fix a race condition, see:...

The Python finalization is a complex task. I took some notes about recent changes: https://pythondev.readthedocs.io/finalization.html You're free to call os._exit() to skip any kind of cleanup: simple and fast. The...

> Add pythoncapi_compat.h header file to get PyFrame_GetLasti() With this header file, it also becomes possible to drop MyFrame_GetCode() from coverage/ctracer/util.h and use PyFrame_GetCode() on all Python versions. It would...

Current implementation of PyFrame_GetLasti() in **upstream** pythoncapi_compat.h: ``` // bpo-40421 added PyFrame_GetLasti() to Python 3.11.0b1 #if PY_VERSION_HEX < 0x030B00B1 && !defined(PYPY_VERSION) PYCAPI_COMPAT_STATIC_INLINE(int) PyFrame_GetLasti(PyFrameObject *frame) { #if PY_VERSION_HEX >= 0x030A00A7 //...

@nedbat: Are you ok to use pythoncapi_compat.h? As I wrote, it would allow to fix the coverage MyFrame_GetCode() refleak (I can work on a fix, once this PR is merged).

I deleted my comment. I went 1 week in holiday and it is way enough for me to forget the context :-) This PR is supposed to support Python 3.11...

> Also, co_code has been gone since https://github.com/python/cpython/commit/2bde6827ea4f136297b2d882480b981ff26262b6. Which is 3.11a7 and up only. For that you'd need the internal _PyCode_GetCode (Huh, I just realised we should probably expose that...

Or you can already use ``PyObject_GetAttrString(code, "co_code")``.

See https://github.com/python/cpython/issues/91397 "Move the PyCodeObject structure to the internal C API (make the structure opaque)".

> @nedbat I have a WIP branch [1](https://github.com/nedbat/coveragepy/pull/1353#user-content-fn-1-b7c3bebea816c70ceec203f0e04e9cf7) which uses pythoncapi_compat Can you create a PR for that?