diff options
| author | Erlend E. Aasland <erlend.aasland@protonmail.com> | 2023-06-09 21:53:33 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-09 21:53:33 (GMT) |
| commit | d636d7dfe714e7168b342c7ea5f9f9d3b3569ed0 (patch) | |
| tree | aff5fb616fff4d51efcc4f77c6d8c9775e8f474d | |
| parent | 33c92c4f15539806c8aff8574ff30a8b307e3e4d (diff) | |
| download | cpython-d636d7dfe714e7168b342c7ea5f9f9d3b3569ed0.zip cpython-d636d7dfe714e7168b342c7ea5f9f9d3b3569ed0.tar.gz cpython-d636d7dfe714e7168b342c7ea5f9f9d3b3569ed0.tar.bz2 | |
gh-105375: Harden error handling in `_testcapi/heaptype.c` (#105608)
Bail on first error in heapctypesubclasswithfinalizer_finalize()
| -rw-r--r-- | Modules/_testcapi/heaptype.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/_testcapi/heaptype.c b/Modules/_testcapi/heaptype.c index 3488e35..565ab57 100644 --- a/Modules/_testcapi/heaptype.c +++ b/Modules/_testcapi/heaptype.c @@ -661,8 +661,11 @@ heapctypesubclasswithfinalizer_finalize(PyObject *self) goto cleanup_finalize; } oldtype = PyObject_GetAttrString(m, "HeapCTypeSubclassWithFinalizer"); + if (oldtype == NULL) { + goto cleanup_finalize; + } newtype = PyObject_GetAttrString(m, "HeapCTypeSubclass"); - if (oldtype == NULL || newtype == NULL) { + if (newtype == NULL) { goto cleanup_finalize; } |
