Skip to content

Commit a455573

Browse files
committed
Add stats for self iter and fix naming in summary
1 parent 10cd875 commit a455573

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Python/specialize.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,7 @@ _PyCode_Quicken(_Py_CODEUNIT *instructions, Py_ssize_t size, int enable_counters
669669
#define SPEC_FAIL_ITER_CALLABLE 28
670670
#define SPEC_FAIL_ITER_ASCII_STRING 29
671671
#define SPEC_FAIL_ITER_ASYNC_GENERATOR_SEND 30
672+
#define SPEC_FAIL_ITER_SELF 31
672673

673674
// UNPACK_SEQUENCE
674675

@@ -3154,6 +3155,9 @@ _Py_GatherStats_GetIter(_PyStackRef iterable)
31543155
else if (tp == &_PyAsyncGenASend_Type) {
31553156
kind = SPEC_FAIL_ITER_ASYNC_GENERATOR_SEND;
31563157
}
3158+
else if (tp->tp_iter == PyObject_SelfIter) {
3159+
kind = SPEC_FAIL_ITER_SELF;
3160+
}
31573161
SPECIALIZATION_FAIL(GET_ITER, kind);
31583162
}
31593163
#endif

Tools/scripts/summarize_stats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def kind_to_text(kind: int, opcode: str):
288288
opcode = "SUPER"
289289
elif opcode.endswith("ATTR"):
290290
opcode = "ATTR"
291-
elif opcode in ("FOR_ITER", "SEND"):
291+
elif opcode in ("FOR_ITER", "GET_ITER", "SEND"):
292292
opcode = "ITER"
293293
elif opcode.endswith("SUBSCR"):
294294
opcode = "SUBSCR"

0 commit comments

Comments
 (0)