aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-11-22 14:45:16 +0100
committerGitHub <noreply@github.com>2018-11-22 14:45:16 +0100
commit4d73ae776140a583fdfe8f016d88cc767791e481 (patch)
tree9cd76db8c15c8f760f5ad5bda224161182952d89 /Include/asdl.h
parentbpo-18407: win32_urandom() uses PY_DWORD_MAX (GH-10656) (diff)
downloadcpython-4d73ae776140a583fdfe8f016d88cc767791e481.tar.gz
cpython-4d73ae776140a583fdfe8f016d88cc767791e481.tar.bz2
cpython-4d73ae776140a583fdfe8f016d88cc767791e481.zip
bpo-18407: ast.c uses Py_ssize_t for asdl_seq_LEN() iterator (GH-10655)
When iterating using asdl_seq_LEN(), use 'Py_ssize_t' type instead of 'int' for the iterator variable, to avoid downcast on 64-bit platforms. _Py_asdl_int_seq_new() now also ensures that the index is greater than or equal to 0.
Diffstat (limited to 'Include/asdl.h')
-rw-r--r--Include/asdl.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/Include/asdl.h b/Include/asdl.h
index 35e9fa18601..fc6d22371b6 100644
--- a/Include/asdl.h
+++ b/Include/asdl.h
@@ -36,7 +36,7 @@ asdl_int_seq *_Py_asdl_int_seq_new(Py_ssize_t size, PyArena *arena);
do { \
Py_ssize_t _asdl_i = (I); \
assert((S) != NULL); \
- assert(_asdl_i < (S)->size); \
+ assert(0 <= _asdl_i && _asdl_i < (S)->size); \
(S)->elements[_asdl_i] = (V); \
} while (0)
#else