Skip to content

Commit

Permalink
Fix PyType_FromSpec() error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
vstinner committed Nov 17, 2023
1 parent 266a8e5 commit e63c937
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Modules/_testcapimodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ test_get_type_name(PyObject *self, PyObject *Py_UNUSED(ignored))

PyObject *HeapTypeNameType = PyType_FromSpec(&HeapTypeNameType_Spec);
if (HeapTypeNameType == NULL) {
Py_RETURN_NONE;
return NULL;
}
tp_name = PyType_GetName((PyTypeObject *)HeapTypeNameType);
assert(PyUnicode_EqualToUTF8(tp_name, "HeapTypeNameType"));
Expand Down Expand Up @@ -620,7 +620,7 @@ test_get_type_qualname(PyObject *self, PyObject *Py_UNUSED(ignored))

PyObject *HeapTypeNameType = PyType_FromSpec(&HeapTypeNameType_Spec);
if (HeapTypeNameType == NULL) {
Py_RETURN_NONE;
return NULL;
}
tp_qualname = PyType_GetQualName((PyTypeObject *)HeapTypeNameType);
assert(PyUnicode_EqualToUTF8(tp_qualname, "HeapTypeNameType"));
Expand Down Expand Up @@ -658,7 +658,7 @@ test_get_type_fullyqualname(PyObject *self, PyObject *Py_UNUSED(ignored))

PyObject *HeapTypeNameType = PyType_FromSpec(&HeapTypeNameType_Spec);
if (HeapTypeNameType == NULL) {
Py_RETURN_NONE;
return NULL;
}
name = PyType_GetFullyQualifiedName((PyTypeObject *)HeapTypeNameType);
assert(PyUnicode_EqualToUTF8(name, "_testcapi.HeapTypeNameType"));
Expand Down

0 comments on commit e63c937

Please sign in to comment.