]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-94673: Fix _PyTypes_InitTypes() and get_type_attr_as_size() (gh-103961)
authorEric Snow <ericsnowcurrently@gmail.com>
Fri, 28 Apr 2023 00:28:51 +0000 (18:28 -0600)
committerGitHub <noreply@github.com>
Fri, 28 Apr 2023 00:28:51 +0000 (18:28 -0600)
This change has two small parts:

1. a follow-up to gh-103940 with one case I missed
2. adding a missing return that I noticed while working on related code

Objects/object.c
Objects/structseq.c

index cd610297aacba07dd029d8c3220c427cf9814643..4ce10cf1192d3f520e885f289d3bdf787dc0982f 100644 (file)
@@ -2102,10 +2102,6 @@ static PyTypeObject* static_types[] = {
 PyStatus
 _PyTypes_InitTypes(PyInterpreterState *interp)
 {
-    if (!_Py_IsMainInterpreter(interp)) {
-        return _PyStatus_OK();
-    }
-
     // All other static types (unless initialized elsewhere)
     for (size_t i=0; i < Py_ARRAY_LENGTH(static_types); i++) {
         PyTypeObject *type = static_types[i];
index 727d72865e3bb34c627d0e6cd75a613d6c6fedc9..88a71bc52958f5053736729ae8ce6a198044573d 100644 (file)
@@ -31,6 +31,7 @@ get_type_attr_as_size(PyTypeObject *tp, PyObject *name)
         PyErr_Format(PyExc_TypeError,
                      "Missed attribute '%U' of type %s",
                      name, tp->tp_name);
+        return -1;
     }
     return PyLong_AsSsize_t(v);
 }