Skip to content

Commit 4e44e85

Browse files
committed
Extend iteration by index to strings and bytes
1 parent 9b65402 commit 4e44e85

21 files changed

+492
-272
lines changed

Include/cpython/object.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,9 @@ struct _typeobject {
239239
* Otherwise, limited to MAX_VERSIONS_PER_CLASS (defined elsewhere).
240240
*/
241241
uint16_t tp_versions_used;
242+
/* Returns the object at the index given, or NULL if out-of-bounds
243+
* Never raises an exception. */
244+
iterindexfunc tp_iterindex;
242245
};
243246

244247
#define _Py_ATTR_CACHE_UNUSED (30000) // (see tp_versions_used)

Include/internal/pycore_magic_number.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ Known values:
281281
Python 3.15a1 3651 (Simplify LOAD_CONST)
282282
Python 3.15a1 3652 (Virtual iterators)
283283
Python 3.15a1 3653 (Fix handling of opcodes that may leave operands on the stack when optimizing LOAD_FAST)
284-
Python 3.15a1 3654 (Specialize GET_ITER)
284+
Python 3.15a1 3654 (Specialize GET_ITER. Add FOR_ITER_INDEX)
285285
286286
287287
Python 3.16 will start with 3700

Include/internal/pycore_opcode_metadata.h

Lines changed: 8 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)