summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2023-04-28 00:28:51 (GMT)
committerGitHub <noreply@github.com>2023-04-28 00:28:51 (GMT)
commit424a785a07049924603228b153f746cfe3a983a2 (patch)
treefb784848fcc8408f6eadb7dffe3d62dc394ae4eb
parentd2e2e53f733f8c8098035bbbc452bd1892796cb3 (diff)
downloadcpython-424a785a07049924603228b153f746cfe3a983a2.zip
cpython-424a785a07049924603228b153f746cfe3a983a2.tar.gz
cpython-424a785a07049924603228b153f746cfe3a983a2.tar.bz2
gh-94673: Fix _PyTypes_InitTypes() and get_type_attr_as_size() (gh-103961)
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
-rw-r--r--Objects/object.c4
-rw-r--r--Objects/structseq.c1
2 files changed, 1 insertions, 4 deletions
diff --git a/Objects/object.c b/Objects/object.c
index cd61029..4ce10cf 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -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];
diff --git a/Objects/structseq.c b/Objects/structseq.c
index 727d728..88a71bc 100644
--- a/Objects/structseq.c
+++ b/Objects/structseq.c
@@ -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);
}