On Sat, Apr 27, 2019, 04:27 Armin Rigo <armin.r...@gmail.com> wrote: > Hi Neil, > > On Wed, 24 Apr 2019 at 21:17, Neil Schemenauer <nas-pyt...@arctrix.com> > wrote: > > Regarding the Py_TRACE_REFS fields, I think we can't do them without > > breaking the ABI because of the following. For GC objects, they are > > always allocated by _PyObject_GC_New/_PyObject_GC_NewVar. So, we > > can allocate the extra space needed for the GC linked list. For > > non-GC objects, that's not the case. Extensions can allocate using > > malloc() directly or their own allocator and then pass that memory > > to be initialized as a PyObject. > > > > I think that's a poor design and I think we should try to make slow > > progress in fixing it. > > Such progress needs to start with the global static PyTypeObjects that > all extensions define. This is going to be impossible to fix without > requiring a big fix in of *all* of them. (Unless of course you mean > to still allow them, but then Py_TRACE_REF can't be implemented in a > way that doesn't break the ABI.) >
For Py_TRACE_REFS specifically, IIUC the only goal is to be able to produce a list of all live objects on demand. If that's the goal, then static type objects aren't a huge deal. You can't add extra data into the type objects themselves, but since there's a fixed set of them and they're immortal, you can just build a static list of all of them in PyType_Ready. -n >
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com