[issue40170] [C API] Prepare PyTypeObject structure for a stable ABI: avoid accessing members in the public API

2022-01-28 Thread STINNER Victor


STINNER Victor  added the comment:

I close the issue. While this issue is not fully fixed, it's a milestone of my 
"stable ABI" goal. I prefer to address remaining issues in new separted issues.

This issues is not fully fixed, there are are still a 4 macros which access 
directly PyTypeObject members:

* PySequence_ITEM()
* _PyObject_SIZE()
* _PyObject_VAR_SIZE()
* PyType_HasFeature() (if Py_LIMITED_API is not defined)

PySequence_ITEM() and PyType_HasFeature() are important for performance, I 
prefer to have a PEP before changing these two functions.

_PyObject_SIZE() and _PyObject_VAR_SIZE() should be made public with a better 
name like PyObject_SizeOf() and PyVarObject_SizeOf(). But I prefer to do that 
in a separated issue.

IMO it would be interesting to merge the PyHeapTypeObject structure into the 
PyTypeObject structure:
https://bugs.python.org/issue46433#msg411167

And make the PyTypeObject opaque: deprecate static types and promote the usage 
of heap types in C extensions. That's a big project which may be splitted into 
multiple issues and the final change may need its own PEP.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40170] [C API] Prepare PyTypeObject structure for a stable ABI: avoid accessing members in the public API

2022-01-28 Thread Michael Felt


Change by Michael Felt :


--
nosy:  -Michael.Felt

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40170] [C API] Prepare PyTypeObject structure for a stable ABI: avoid accessing members in the public API

2022-01-28 Thread STINNER Victor


Change by STINNER Victor :


--
title: [C API] Make PyTypeObject structure an opaque structure in the public C 
API -> [C API] Prepare PyTypeObject structure for a stable ABI: avoid accessing 
members in the public API

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com