STINNER Victor <vstin...@python.org> added the comment:

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".

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33607>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to