-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
gh-103082: Fix shifted field initialization in instrumentation.c
#103561
gh-103082: Fix shifted field initialization in instrumentation.c
#103561
Conversation
🤖 New build scheduled with the buildbot fleet by @arhadthedev for commit 286fdc9 🤖 If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
instrumentation.c
instrumentation.c
@markshannon as an author of gh-103083 this PR fixes. |
@@ -16,14 +16,14 @@ | |||
|
|||
static PyObject DISABLE = | |||
{ | |||
_PyObject_IMMORTAL_REFCNT, | |||
&PyBaseObject_Type | |||
.ob_refcnt = _PyObject_IMMORTAL_REFCNT, |
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.
Explicit setting of these fields seems a bit odd to me.
@markshannon should review and merge it since this is recently introduced file.
I think the use of named initializers is fine. Since we can always change it to use macros later, and this fixes compilation, I'm merging this. |
If
Py_TRACE_REFS
is defined,PyObject
initializers without field names like:cpython/Python/instrumentation.c
Lines 17 to 21 in 2b6f5c3
The reason is implicit insertion of two extra fields under
#ifdef Py_TRACE_REFS
:cpython/Include/object.h
Lines 102 to 106 in 2b6f5c3
cpython/Include/object.h
Lines 65 to 76 in 2b6f5c3
This commit fixes declarations that fail the(edit: all other places useAMD64 Arch Linux TraceRefs PR
buildbot. Other declarations will be fixed in another, pending PR._PyObject_HEAD_EXTRA
)I desided to not use
_PyObject_HEAD_EXTRA
because it can be forgotten easily (unlike explicit field names) so we should phase it out from CPython codebase if possible.