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-134411: Fix dangerous reference count decrement#134415

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

Open
smurav wants to merge6 commits intopython:main
base:main
Choose a base branch
Loading
fromsmurav:fix-gh-134411

Conversation

smurav
Copy link
Contributor

Fix forgh-134411.

Copy link
Member

@ZeroIntensityZeroIntensity left a comment

Choose a reason for hiding this comment

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

PyLong_FromLong sets an exception when it fails, so the call toPyObject_SetAttrString is unsafe. We should returnNULL instead of switching toPy_XDECREF.

But, as@sergey-miryanov mentioned, this can't fail for integers <255. I think it's also reasonable to add an assertion here instead of adding error handling.

…case and can't return NULL. Added assert for extra confidence.python#134411 (comment)
@ZeroIntensityZeroIntensity added skip news needs backport to 3.13bugs and security fixes needs backport to 3.14bugs and security fixes labelsMay 21, 2025
Copy link
Member

@ZeroIntensityZeroIntensity left a comment

Choose a reason for hiding this comment

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

LGTM, with one little note.

@@ -2558,18 +2558,22 @@ PyObject *_Py_CreateMonitoringObject(void)
err = PyObject_SetAttrString(events, "NO_EVENTS", _PyLong_GetZero());
if (err) goto error;
PyObject *val = PyLong_FromLong(PY_MONITORING_DEBUGGER_ID);
assert(val != NULL);

Choose a reason for hiding this comment

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

I think it'd be a good idea to add a comment explaining why it can't ever fail.

smurav reacted with thumbs up emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I'll add it tomorrow.

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

@ZeroIntensityZeroIntensityZeroIntensity approved these changes

Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@smurav@ZeroIntensity

[8]ページ先頭

©2009-2025 Movatter.jp