◐ Shell
clean mode source ↗

gh-101765: Fix refcount issues in list and unicode pickling by JelleZijlstra · Pull Request #102265 · python/cpython

@bedevere-bot

🤖 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.

iritkatriel

Choose a reason for hiding this comment

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

LGTM

@miss-islington

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!

@miss-islington

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

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

@bedevere-bot

JelleZijlstra added a commit to JelleZijlstra/cpython that referenced this pull request

Feb 26, 2023

@bedevere-bot

JelleZijlstra added a commit to JelleZijlstra/cpython that referenced this pull request

Feb 26, 2023

kumaraditya303

PyObject *u = unicode_new_empty();
if (u == NULL)
if (u == NULL) {
Py_DECREF(iter);

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.

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.

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.

Choose a reason for hiding this comment

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