pyo3 icon indicating copy to clipboard operation
pyo3 copied to clipboard

Contribution opportunity: use Python 3.12 managed dict and weakref

Open davidhewitt opened this issue 1 year ago • 2 comments

In Python 3.12 type flags were added to make the interpreter automatically handle __dict__ and weakrefs for classes: https://docs.python.org/3.12/c-api/typeobj.html#c.Py_TPFLAGS_MANAGED_DICT

We should be able to switch to these instead of using out own dict_offset and weaklist_offset machinery. It's probably better for performance, and in the long run this would be a nice simplification to the codebase.

davidhewitt avatar Jun 14 '24 11:06 davidhewitt

May I have a look into this?

Cheukting avatar Jul 20 '24 17:07 Cheukting

Please do, as far as I know nobody else has suggested they have availability to try this.

davidhewitt avatar Jul 21 '24 12:07 davidhewitt