]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-121791: Check for `NULL` in `MethodDescriptor2_new` in `_testcapi` (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 16 Jul 2024 08:55:37 +0000 (10:55 +0200)
committerGitHub <noreply@github.com>
Tue, 16 Jul 2024 08:55:37 +0000 (08:55 +0000)
gh-121791: Check for `NULL` in `MethodDescriptor2_new` in `_testcapi` (GH-121792)
(cherry picked from commit 8b6d4755812d0b02e9f26beb9c9a7714e4c5ac28)

Co-authored-by: sobolevn <mail@sobolevn.me>
Modules/_testcapi/vectorcall.c

index b30c5e8704c8af46fe3e2c6d760b9b627fd33d8d..03aaacb328e0b6d15d4a6b764443c026b3160d49 100644 (file)
@@ -348,6 +348,9 @@ static PyObject *
 MethodDescriptor2_new(PyTypeObject* type, PyObject* args, PyObject *kw)
 {
     MethodDescriptor2Object *op = PyObject_New(MethodDescriptor2Object, type);
+    if (op == NULL) {
+        return NULL;
+    }
     op->base.vectorcall = NULL;
     op->vectorcall = MethodDescriptor_vectorcall;
     return (PyObject *)op;