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

[WIP] gh-133931: Introduce _PyObject_XSetRefDelayed to replace Py_XSETREF#134377

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

Draft
corona10 wants to merge4 commits intopython:main
base:main
Choose a base branch
Loading
fromcorona10:gh-133931

Conversation

corona10
Copy link
Member

@corona10corona10 commentedMay 20, 2025
edited by bedevere-appbot
Loading

_PyObject_XSetRefDelayed(PyObject **ptr, PyObject *value)
{
PyObject *old = *ptr;
FT_ATOMIC_STORE_PTR_RELEASE(*ptr, Py_NewRef(value));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The default build implementation inpycore_pymem.h doesn't include thePy_NewRef().

My preference is to keep thePy_NewRef(value) in the callers, i.e.:

_PyObject_XSetRefDelayed(dictptr,Py_NewRef(value));

to match the semantics ofPy_XSETREF.

corona10 reacted with thumbs up emoji
@corona10
Copy link
MemberAuthor

Interesting... CI passed in my local but not in the CI.. :(

@corona10
Copy link
MemberAuthor

Ah okay..

test_aclose (test.test_asyncgen.TestUnawaitedWarnings.test_aclose) ... Assertion failed: (!_Py_IsImmortal(op)), function _Py_ExplicitMergeRefcount, file object.c, line 467.

@corona10corona10 changed the titlegh-133931: Introduce _PyObject_XSetRefDelayed to replace Py_XSETREF[WIP] gh-133931: Introduce _PyObject_XSetRefDelayed to replace Py_XSETREFMay 21, 2025
@markshannon
Copy link
Member

Why do we need_PyObject_XSetRefDelayed? It looks like all uses of it are wrapped in critical sections where the oldPy_XSETREF would work.

Also, what is "delayed"? Either choose a clearer name, or add an explanatory comment in the header file.

corona10 reacted with thumbs up emoji

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

@colesburycolesburycolesbury left review comments

@ericsnowcurrentlyericsnowcurrentlyAwaiting requested review from ericsnowcurrentlyericsnowcurrently is a code owner

@markshannonmarkshannonAwaiting requested review from markshannonmarkshannon is a code owner

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@corona10@markshannon@colesbury

[8]ページ先頭

©2009-2025 Movatter.jp