FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-145376: Fix various reference leaks objects and modules by eendebakpt · Pull Request #145385 · python/cpython · GitHub

Repository navigation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix reference leaks in various unusual error scenarios.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I don't think that a NEWS entry is needed since it's unlikely to hit the issue, users are not directly impacted.

4 changes: 3 additions & 1 deletion Modules/itertoolsmodule.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -3538,8 +3538,10 @@ count_nextlong(countobject *lz)
if (long_cnt == NULL) {
/* Switch to slow_mode */
long_cnt = PyLong_FromSsize_t(PY_SSIZE_T_MAX);
if (long_cnt == NULL)
if (long_cnt == NULL) {
return NULL;
}
lz->long_cnt = long_cnt;
Comment thread
sergey-miryanov marked this conversation as resolved.
Outdated
}
assert(lz->cnt == PY_SSIZE_T_MAX && long_cnt != NULL);

Expand Down
1 change: 1 addition & 0 deletions Objects/enumobject.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ increment_longindex_lock_held(enumobject *en)
if (next_index == NULL) {
return NULL;
}
en->en_longindex = next_index;
Comment thread
sergey-miryanov marked this conversation as resolved.
Outdated
}
assert(next_index != NULL);
Comment thread
eendebakpt marked this conversation as resolved.
Outdated
PyObject *stepped_up = PyNumber_Add(next_index, en->one);
Expand Down
4 changes: 3 additions & 1 deletion Objects/listobject.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -4270,7 +4270,9 @@ listiter_reduce_general(void *_it, int forward)
}
/* empty iterator, create an empty list */
list = PyList_New(0);
if (list == NULL)
if (list == NULL) {
Py_DECREF(iter);
return NULL;
}
return Py_BuildValue("N(N)", iter, list);
}
Loading

Back | FazBrowse Home | New Git URL