Skip to content

Commit 106d645

Browse files
[3.12] gh-121791: Check for NULL in MethodDescriptor2_new in _testcapi (GH-121792) (#121840)
gh-121791: Check for `NULL` in `MethodDescriptor2_new` in `_testcapi` (GH-121792) (cherry picked from commit 8b6d475) Co-authored-by: sobolevn <[email protected]>
1 parent 52df6c4 commit 106d645

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Modules/_testcapi/vectorcall.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,9 @@ static PyObject *
349349
MethodDescriptor2_new(PyTypeObject* type, PyObject* args, PyObject *kw)
350350
{
351351
MethodDescriptor2Object *op = PyObject_New(MethodDescriptor2Object, type);
352+
if (op == NULL) {
353+
return NULL;
354+
}
352355
op->base.vectorcall = NULL;
353356
op->vectorcall = MethodDescriptor_vectorcall;
354357
return (PyObject *)op;

0 commit comments

Comments
 (0)