mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
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.
This commit is contained in:
parent
c48ff73dd6
commit
4d73ae7761
2 changed files with 10 additions and 10 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue