Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

STOP_ITERATION monitoring event is not triggered by unspecialized bytecode #116090

Closed as not planned
Assignees
markshannon
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error
@swtaarrs

Description

@swtaarrs

Bug report

Bug description:

Repro: Check outthis commit, build, and runpython -mtest test_monitoring -mtest_implicit_stop_iteration.

Context: The unspecialized implementation ofFOR_ITER has some built-in opcode fusion, in thatit skips the followingEND_FOR andPOP_TOP whentp_iternext returnsNULL. When the iterator is a generator, as it is inExceptionMonitoringTest.test_implicit_stop_iteration(), that means we skip themonitor_stop_iteration() call inINSTRUMENTED_END_FOR.

test_implicit_stop_iteration() passes as written, though, because theFOR_ITER in the helper function has been specialized toFOR_ITER_GEN by the time the generator finishes, andFOR_ITER_GEN's implementation doesn't perform the same fusion asFOR_ITER.

This bug can be exposed by makingthis change totest_implicit_stop_iteration(), so theFOR_ITER stays unspecialized while iterating over the generator in question.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

Labels

interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp