Skip to content
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-101765: Fix refcount issues in list and unicode pickling #102265

Merged
merged 1 commit into from
Feb 26, 2023

Conversation

JelleZijlstra
Copy link
Member

@JelleZijlstra JelleZijlstra commented Feb 25, 2023

@JelleZijlstra JelleZijlstra added skip news 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section labels Feb 25, 2023
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @JelleZijlstra for commit b8ad59e 🤖

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

Copy link
Member

@iritkatriel iritkatriel left a comment

Choose a reason for hiding this comment

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

LGTM

@miss-islington
Copy link
Contributor

Thanks @JelleZijlstra for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@JelleZijlstra JelleZijlstra deleted the refcount branch February 26, 2023 00:02
@miss-islington
Copy link
Contributor

Sorry, @JelleZijlstra, I could not cleanly backport this to 3.11 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker d71edbd1b7437706519a9786211597d95934331a 3.11

@miss-islington
Copy link
Contributor

Sorry @JelleZijlstra, I had trouble checking out the 3.10 backport branch.
Please retry by removing and re-adding the "needs backport to 3.10" label.
Alternatively, you can backport using cherry_picker on the command line.
cherry_picker d71edbd1b7437706519a9786211597d95934331a 3.10

@JelleZijlstra
Copy link
Member Author

Working on the backports

@bedevere-bot
Copy link

GH-102268 is a backport of this pull request to the 3.11 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Feb 26, 2023
JelleZijlstra added a commit to JelleZijlstra/cpython that referenced this pull request Feb 26, 2023
…ing (pythonGH-102265)

Followup from pythonGH-101769..
(cherry picked from commit d71edbd)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
@bedevere-bot
Copy link

GH-102269 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Feb 26, 2023
JelleZijlstra added a commit to JelleZijlstra/cpython that referenced this pull request Feb 26, 2023
…ing (pythonGH-102265)

Followup from pythonGH-101769..
(cherry picked from commit d71edbd)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
JelleZijlstra added a commit that referenced this pull request Feb 26, 2023
JelleZijlstra added a commit that referenced this pull request Feb 26, 2023
@@ -14794,8 +14794,10 @@ unicodeiter_reduce(unicodeiterobject *it, PyObject *Py_UNUSED(ignored))
return Py_BuildValue("N(O)n", iter, it->it_seq, it->it_index);
} else {
PyObject *u = unicode_new_empty();
if (u == NULL)
if (u == NULL) {
Py_DECREF(iter);
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be Py_XDECREF? There is no null check above for iter.

Copy link
Member

Choose a reason for hiding this comment

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

Good point. But shouldn’t it be a null check and return above, if iter is null I think it would crash in the BuildValue before we even get here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Py_BuildValue deals with NULL internally; if one of the args is NULL it itself returns NULL, propagating the exception. So changing to XDECREF here should be enough.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants