◐ Shell
clean mode source ↗

Message 368913 - Python tracker

I see two options:

* Add a field to PyObject, but only in a special debug mode. Maybe not even in Py_DEBUG (since I managed to make Py_DEBUG ABI-compatible with the release mode!)

* Add an hash table mapping an object to its interpreter. The hash table would only be used in debug mode. It may even be turned on at runtime depending on a command line option or something else.

See also bpo-40514: [subinterpreters] Add --experimental-isolated-subinterpreters build option.


Antoine: "Can I ask why you're considering this?  I thought you didn't want to transfer ownership between interpreters."

I guess that the purpose is to ensure that: detect when an object is shared between two interpreters.

Currently, tons of objects are still shared between interpreters. Starting with static types: see bpo-40601 "[C API] Hide static types from the limited C API".