Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-103082: Fix shifted field initialization ininstrumentation.c#103561

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

arhadthedev
Copy link
Member

@arhadthedevarhadthedev commentedApr 15, 2023
edited
Loading

IfPy_TRACE_REFS is defined,PyObject initializers without field names like:

staticPyObjectDISABLE=
{
_PyObject_IMMORTAL_REFCNT,
&PyBaseObject_Type
};
are compiled in a totally unusable way:

_ob_next = _PyObject_IMMORTAL_REFCNT (999999999)_ob_prev = &PyBaseObject_Typeob_refcnt = 0ob_type = NULL

The reason is implicit insertion of two extra fields under#ifdef Py_TRACE_REFS:

struct_object {
_PyObject_HEAD_EXTRA
Py_ssize_tob_refcnt;
PyTypeObject*ob_type;
};
#ifdefPy_TRACE_REFS
/* Define pointers to support a doubly-linked list of all live heap objects. */
#define_PyObject_HEAD_EXTRA \
PyObject *_ob_next; \
PyObject *_ob_prev;
#define_PyObject_EXTRA_INIT _Py_NULL, _Py_NULL,
#else
# define_PyObject_HEAD_EXTRA
# define_PyObject_EXTRA_INIT
#endif

This commit fixes declarations that fail theAMD64 Arch Linux TraceRefs PR buildbot. Other declarations will be fixed in another, pending PR. (edit: all other places use_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.

@arhadthedevarhadthedev added interpreter-core(Objects, Python, Grammar, and Parser dirs) type-crashA hard crash of the interpreter, possibly with a core dump needs backport to 3.11only security fixes labelsApr 15, 2023
@arhadthedevarhadthedev added the 🔨 test-with-buildbotsTest PR w/ buildbots; report in status section labelApr 15, 2023
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by@arhadthedev for commit286fdc9 🤖

If you want to schedule another build, you need to add the🔨 test-with-buildbots label again.

@bedevere-botbedevere-bot removed the 🔨 test-with-buildbotsTest PR w/ buildbots; report in status section labelApr 15, 2023
@arhadthedevarhadthedev added 3.12only security fixes and removed needs backport to 3.11only security fixes labelsApr 15, 2023
@arhadthedevarhadthedev changed the titleFix shifted field initialization ininstrumentation.cgh-103082: Fix shifted field initialization ininstrumentation.cApr 15, 2023
@bedevere-botbedevere-bot mentioned this pull requestApr 15, 2023
4 tasks
@arhadthedevarhadthedev marked this pull request as ready for reviewApril 15, 2023 13:32
@arhadthedev
Copy link
MemberAuthor

@markshannon as an author ofgh-103083 this PR fixes.

@@ -16,14 +16,14 @@

static PyObject DISABLE =
{
_PyObject_IMMORTAL_REFCNT,
&PyBaseObject_Type
.ob_refcnt = _PyObject_IMMORTAL_REFCNT,
Copy link
Member

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.

@markshannon
Copy link
Member

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.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@orsenthilorsenthilorsenthil left review comments

@kumaraditya303kumaraditya303kumaraditya303 approved these changes

@markshannonmarkshannonAwaiting requested review from markshannon

Assignees
No one assigned
Labels
3.12only security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)skip newstype-crashA hard crash of the interpreter, possibly with a core dump
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@arhadthedev@bedevere-bot@markshannon@orsenthil@kumaraditya303

[8]ページ先頭

©2009-2025 Movatter.jp