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

gh-110237: Check `PyList_Append` for errors in `_PyEval_MatchClass` by denballakh · Pull Request #110238 · python/cpython · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension .c  (1) .rst  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
Next Next commit
Check PyList_Append for errors in _PyEval_MatchClass
  • Loading branch information
denballakh committed Oct 2, 2023
commit 600883f645aa287f8d96900acef5459d58797811
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 @@
Check `PyList_Append` for errors in `_PyEval_MatchClass`
Comment thread
denballakh marked this conversation as resolved.
Resolved
14 changes: 11 additions & 3 deletions Python/ceval.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 @@ -506,7 +506,9 @@ _PyEval_MatchClass(PyThreadState *tstate, PyObject *subject, PyObject *type,
}
if (match_self) {
// Easy. Copy the subject itself, and move on to kwargs.
PyList_Append(attrs, subject);
if (PyList_Append(attrs, subject) == -1) {
Comment thread
JelleZijlstra marked this conversation as resolved.
Resolved
goto fail;
}
}
else {
for (Py_ssize_t i = 0; i < nargs; i++) {
Expand All @@ -522,7 +524,10 @@ _PyEval_MatchClass(PyThreadState *tstate, PyObject *subject, PyObject *type,
if (attr == NULL) {
goto fail;
}
PyList_Append(attrs, attr);
if (PyList_Append(attrs, attr) == -1) {
Py_DECREF(attr);
goto fail;
}
Py_DECREF(attr);
}
}
Expand All @@ -535,7 +540,10 @@ _PyEval_MatchClass(PyThreadState *tstate, PyObject *subject, PyObject *type,
if (attr == NULL) {
goto fail;
}
PyList_Append(attrs, attr);
if (PyList_Append(attrs, attr) == -1) {
Py_DECREF(attr);
goto fail;
}
Py_DECREF(attr);
}
Py_SETREF(attrs, PyList_AsTuple(attrs));
Expand Down

Back | FazBrowse Home | New Git URL