mirror of
https://github.com/python/cpython.git
synced 2026-04-20 19:01:14 +00:00
GH-145668: Add FOR_ITER specialization for virtual iterators. Specialize GET_ITER. (GH-147967)
* Add FOR_ITER_VIRTUAL to specialize FOR_ITER for virtual iterators * Add GET_ITER_SELF to specialize GET_ITER for iterators (including generators) * Add GET_ITER_VIRTUAL to specialize GET_ITER for iterables as virtual iterators * Add new (internal) _tp_iteritem function slot to PyTypeObject * Put limited RESUME at start of genexpr for free-threading. Fix up exception handling in genexpr
This commit is contained in:
parent
0fcf2b72d3
commit
600f4dbd54
37 changed files with 2987 additions and 1534 deletions
|
|
@ -574,8 +574,12 @@ init_code(PyCodeObject *co, struct _PyCodeConstructor *con)
|
|||
co->co_tlbc->entries[0] = co->co_code_adaptive;
|
||||
#endif
|
||||
int entry_point = 0;
|
||||
while (entry_point < Py_SIZE(co) &&
|
||||
_PyCode_CODE(co)[entry_point].op.code != RESUME) {
|
||||
while (entry_point < Py_SIZE(co)) {
|
||||
if (_PyCode_CODE(co)[entry_point].op.code == RESUME &&
|
||||
(_PyCode_CODE(co)[entry_point].op.arg & RESUME_OPARG_LOCATION_MASK) != RESUME_AT_GEN_EXPR_START
|
||||
) {
|
||||
break;
|
||||
}
|
||||
entry_point++;
|
||||
}
|
||||
co->_co_firsttraceable = entry_point;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue