-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-135913: Document ob_refcnt, ob_type, ob_size #135914
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
base: main
Are you sure you want to change the base?
Conversation
.. c:member:: Py_ssize_t ob_refcnt | ||
|
||
The object's reference count, as returned by :c:macro:`Py_REFCNT`. | ||
Do not use this field directly; instead use functions and macros such as | ||
:c:macro:`!Py_REFCNT`, :c:func:`Py_INCREF` and :c:func:`Py_DecRef`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is accurate anymore:
Lines 128 to 146 in a88b49c
union { | |
#if SIZEOF_VOID_P > 4 | |
PY_INT64_T ob_refcnt_full; /* This field is needed for efficient initialization with Clang on ARM */ | |
struct { | |
# if PY_BIG_ENDIAN | |
uint16_t ob_flags; | |
uint16_t ob_overflow; | |
uint32_t ob_refcnt; | |
# else | |
uint32_t ob_refcnt; | |
uint16_t ob_overflow; | |
uint16_t ob_flags; | |
# endif | |
}; | |
#else | |
Py_ssize_t ob_refcnt; | |
#endif | |
_Py_ALIGNED_DEF(_PyObject_MIN_ALIGNMENT, char) _aligner; | |
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, yes, the type isn't Py_ssize_t
any more.
That's an issue in the current documentation too; guess it's time to reopen #125174 for a docs update.
Similarly, a lot of the docs talk about PyObject_HEAD_INIT
setting the refcount to 1. I can't fix everything in this PR...
📚 Documentation preview 📚: https://cpython-previews--135914.org.readthedocs.build/