mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
gh-123465: Allow Py_RELATIVE_OFFSET for __*offset__ members (GH-123474)
This commit is contained in:
parent
ce9f84a47b
commit
16be8db6be
8 changed files with 422 additions and 74 deletions
|
|
@ -485,7 +485,8 @@ Accessing attributes of extension types
|
|||
``PyMemberDef`` may contain a definition for the special member
|
||||
``"__vectorcalloffset__"``, corresponding to
|
||||
:c:member:`~PyTypeObject.tp_vectorcall_offset` in type objects.
|
||||
These must be defined with ``Py_T_PYSSIZET`` and ``Py_READONLY``, for example::
|
||||
This member must be defined with ``Py_T_PYSSIZET``, and either
|
||||
``Py_READONLY`` or ``Py_READONLY | Py_RELATIVE_OFFSET``. For example::
|
||||
|
||||
static PyMemberDef spam_type_members[] = {
|
||||
{"__vectorcalloffset__", Py_T_PYSSIZET,
|
||||
|
|
@ -506,6 +507,12 @@ Accessing attributes of extension types
|
|||
``PyMemberDef`` is always available.
|
||||
Previously, it required including ``"structmember.h"``.
|
||||
|
||||
.. versionchanged:: 3.14
|
||||
|
||||
:c:macro:`Py_RELATIVE_OFFSET` is now allowed for
|
||||
``"__vectorcalloffset__"``, ``"__dictoffset__"`` and
|
||||
``"__weaklistoffset__"``.
|
||||
|
||||
.. c:function:: PyObject* PyMember_GetOne(const char *obj_addr, struct PyMemberDef *m)
|
||||
|
||||
Get an attribute belonging to the object at address *obj_addr*. The
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue