GH-132554: Add stats for GET_ITER (GH-132592)

* Add stats for GET_ITER

* Look for common iterable types, not iterator types

* Add stats for self iter and fix naming in summary
This commit is contained in:
Mark Shannon 2025-04-29 09:00:14 +01:00 committed by GitHub
parent 01f11a0e4e
commit 622300bdfa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 64 additions and 1 deletions

View file

@ -3029,6 +3029,9 @@ dummy_func(
}
inst(GET_ITER, (iterable -- iter)) {
#ifdef Py_STATS
_Py_GatherStats_GetIter(iterable);
#endif
/* before: [obj]; after [getiter(obj)] */
PyObject *iter_o = PyObject_GetIter(PyStackRef_AsPyObjectBorrow(iterable));
PyStackRef_CLOSE(iterable);