Skip to content

gh-145376: Fix various reference leaks#145377

Open
JelleZijlstra wants to merge 1 commit intopython:mainfrom
JelleZijlstra:refcount-bugs
Open

gh-145376: Fix various reference leaks#145377
JelleZijlstra wants to merge 1 commit intopython:mainfrom
JelleZijlstra:refcount-bugs

Conversation

@JelleZijlstra
Copy link
Member

@JelleZijlstra JelleZijlstra commented Mar 1, 2026

Comment on lines 611 to 615
if (args == NULL || args == Py_None || PyObject_Size(args) < 1) {
Py_XDECREF(args);
assert(!PyErr_Occurred());
return 0;
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (args == NULL || args == Py_None || PyObject_Size(args) < 1) {
Py_XDECREF(args);
assert(!PyErr_Occurred());
return 0;
}
if (args == NULL || args == Py_None) {
assert(!PyErr_Occurred());
return 0;
}
if (PyObject_Size(args) < 1) {
Py_DECREF(args);
assert(!PyErr_Occurred());
return 0;
}

Wouldn't it better be to separate these two cases?

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

Labels

awaiting merge needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants