summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-01-23 01:20:44 (GMT)
committerGitHub <noreply@github.com>2022-01-23 01:20:44 (GMT)
commit976dec9b3b35fddbaa893c99297e0c54731451b5 (patch)
treeb586dc7340faa0ceb626661a3d23e046c6936dc8 /Objects
parentbcacab47bf9e8bee58f6f248638e229ae8ea7992 (diff)
downloadcpython-976dec9b3b35fddbaa893c99297e0c54731451b5.zip
cpython-976dec9b3b35fddbaa893c99297e0c54731451b5.tar.gz
cpython-976dec9b3b35fddbaa893c99297e0c54731451b5.tar.bz2
bpo-46417: _PyList_Fini() clears indexerr (GH-30815)
_PyList_Fini() now clears the 'indexerr' error message.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/listobject.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 0ce58b2..752d9e0 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -15,6 +15,8 @@ class list "PyListObject *" "&PyList_Type"
#include "clinic/listobject.c.h"
+static PyObject *indexerr = NULL;
+
#if PyList_MAXFREELIST > 0
static struct _Py_list_state *
get_list_state(void)
@@ -123,6 +125,10 @@ _PyList_Fini(PyInterpreterState *interp)
struct _Py_list_state *state = &interp->list;
state->numfree = -1;
#endif
+
+ if (_Py_IsMainInterpreter(interp)) {
+ Py_CLEAR(indexerr);
+ }
}
/* Print summary info about the state of the optimized allocator */
@@ -224,8 +230,6 @@ valid_index(Py_ssize_t i, Py_ssize_t limit)
return (size_t) i < (size_t) limit;
}
-static PyObject *indexerr = NULL;
-
PyObject *
PyList_GetItem(PyObject *op, Py_ssize_t i)
{