GH-91432: Specialize FOR_ITER (GH-91713)

* Adds FOR_ITER_LIST and FOR_ITER_RANGE specializations.

* Adds _PyLong_AssignValue() internal function to avoid temporary boxing of ints.
This commit is contained in:
Dennis Sweeney 2022-06-21 06:19:26 -04:00 committed by GitHub
parent c735d54534
commit 5fcfdd87c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 447 additions and 282 deletions

View file

@ -0,0 +1,22 @@
#ifndef Py_INTERNAL_RANGE_H
#define Py_INTERNAL_RANGE_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef Py_BUILD_CORE
# error "this header requires Py_BUILD_CORE define"
#endif
typedef struct {
PyObject_HEAD
long index;
long start;
long step;
long len;
} _PyRangeIterObject;
#ifdef __cplusplus
}
#endif
#endif /* !Py_INTERNAL_RANGE_H */