aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Modules/arraymodule.c
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.com>2025-02-16 15:28:01 +0300
committershadchin <shadchin@yandex-team.com>2025-02-16 16:03:50 +0300
commita27b6a96fdc5ca444428ddef4823d0486dcdccb9 (patch)
treeadde5c24d9ea37e1634e7972e27e682a820ab941 /contrib/tools/python3/Modules/arraymodule.c
parent7a3958c3c6de324baab9dba4bd4eb808c1b839a6 (diff)
downloadydb-a27b6a96fdc5ca444428ddef4823d0486dcdccb9.tar.gz
Update Python 3 to 3.12.9
commit_hash:c8651982d81e18f18e037fb247cc6ae53c4fa7f1
Diffstat (limited to 'contrib/tools/python3/Modules/arraymodule.c')
-rw-r--r--contrib/tools/python3/Modules/arraymodule.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/contrib/tools/python3/Modules/arraymodule.c b/contrib/tools/python3/Modules/arraymodule.c
index d24c5989af..090a7b841c 100644
--- a/contrib/tools/python3/Modules/arraymodule.c
+++ b/contrib/tools/python3/Modules/arraymodule.c
@@ -2966,11 +2966,16 @@ array_arrayiterator___setstate__(arrayiterobject *self, PyObject *state)
Py_ssize_t index = PyLong_AsSsize_t(state);
if (index == -1 && PyErr_Occurred())
return NULL;
- if (index < 0)
- index = 0;
- else if (index > Py_SIZE(self->ao))
- index = Py_SIZE(self->ao); /* iterator exhausted */
- self->index = index;
+ arrayobject *ao = self->ao;
+ if (ao != NULL) {
+ if (index < 0) {
+ index = 0;
+ }
+ else if (index > Py_SIZE(ao)) {
+ index = Py_SIZE(ao); /* iterator exhausted */
+ }
+ self->index = index;
+ }
Py_RETURN_NONE;
}