10000 gh-103743: Add PyUnstable_Object_GC_NewWithExtraData by jbradaric · Pull Request #103744 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-103743: Add PyUnstable_Object_GC_NewWithExtraData #103744

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8000 Prev Previous commit
Doc style fixes
Fix indentation and reword some parts to sound more natural.

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
  • Loading branch information
jbradaric and erlend-aasland authored Apr 29, 2023
commit 525705a284913d13f6722541d183e09f97a1ae36
14 changes: 7 additions & 7 deletions Doc/c-api/gcsupport.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,18 @@ rules:
Analogous to :c:func:`PyObject_GC_New` but allocates *extra_size*
bytes at the end of the object (at offset
:c:member:`~PyTypeObject.tp_basicsize`).
The allocated memory is initialized: to zero, except for the
:c:type:`Python object header <PyObject>`.
The allocated memory is initialized to zeros,
except for the :c:type:`Python object header <PyObject>`.

The extra data will be deallocated with the object, but otherwise it is
not managed by Python.

.. warning::
The function is marked as unstable because the final mechanism
for reserving extra data after an instance is not yet decided.
For allocating a variable number of fields, prefer using
:c:type:`PyVarObject` and :c:member:`~PyTypeObject.tp_itemsize`
instead.
The function is marked as unstable because the final mechanism
for reserving extra data after an instance is not yet decided.
For allocating a variable number of fields, prefer using
:c:type:`PyVarObject` and :c:member:`~PyTypeObject.tp_itemsize`
instead.

.. versionadded:: 3.12

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Add ``PyUnstable_Object_GC_NewWithExtraData`` function that can be used to
Add :c:func:`PyUnstable_Object_GC_NewWithExtraData` function that can be used to
allocate additional memory after an object for data not managed by Python.
0