neonene
neonene
> If you contact me in private, I propose to discuss it with you. I'm here to follow SC because you don't look in good condition now to discuss it.
Although `Py_TPFLAGS_MANAGED_*` are *not* limited C API, some docs have encouraged the flags since 3.12, and [the tutorial](https://github.com/python/cpython/blob/033aa5cfd856e52d5b10fc765631c16b308ee4f1/Doc/extending/newtypes.rst?plain=1#L548-L549) has required `Py_TPFLAGS_MANAGED_WEAKREF` on a static type instead of setting `tp_weaklistoffset`. Then,...
> I propose to add checking of presence of the gc flag for both cases for dict and weakref. Just to avoid a crash, I would use `NotImplementedError` keeping the...
Static types are not discouraged from using `tp_dictoffset` since the alternative is not available: https://github.com/python/cpython/blob/033aa5cfd856e52d5b10fc765631c16b308ee4f1/Doc/c-api/typeobj.rst?plain=1#L1845-L1848 Even on heap types without the GC flag, authors should go back to the tp...
> `Py_TPFLAGS_MANAGED_DICT` implies `Py_TPFLAGS_HAVE_GC` and this is documented. Yes. Keep the original remarks as-is. `Py_TPFLAGS_HAVE_GC` is *recommended* by using "should," since `Py_TPFLAGS_MANAGED_DICT` accepts only heaptypes as I said above. (**EDIT:**...
https://github.com/python/cpython/blob/c419af9e277bea7dd78f4defefc752fe93b0b8ec/Include/internal/pycore_object.h#L939-L942 It looks to me like the offset issues can be resolved all at once. If so, raising `NotImplementedError` should be enough for now in both cases. Ultimately, we could...
These may be good starting points to follow the history/context: * https://github.com/python/steering-council/issues/133 * https://docs.python.org/3.11/c-api/typeobj.html#c.PyTypeObject.tp_dictoffset
This issue can be seen starting from the commit 411b1692811b2ecac59cb0df0f920861c7cf179a with usual numpy-1.25.2.
Regarding `PyType_GetToken()` vs `PyType_GetSlot()`, the following show performance differences on the experiment commit at 4fb9cf80a9e71539e0c01b579c4218c9149f78f1 (now removed), which were noisy: ```py from timeit import timeit setup = ( 'import _testcapi,...
The `tp_bases` can be used in a fallback implementation. I checked the overhead, adding a repeat function temporarily (100972db793a2cb545600289aa91fb856d862fb8): ```py from timeit import timeit setup = f"""if 1: import _testcapi...