Skip to content

Differing behavior for sys.setrace between 3.12 and 3.13 #113728

Closed
@markshannon

Description

@markshannon

Bug report

Bug description:

def gen():
    print(2)
    yield 3
    print(4)

print(next(gen()))

3.12 events

call 14: def gen():
line 15:     print(2)
line 16:     yield 3
retu 16:     yield 3
call 16:     yield 3
exce 16:     yield 3
retu 16:     yield 3

main:

call 14: def gen():
line 15:     print(2)
line 16:     yield 3
retu 16:     yield 3

Note the extra except and return events for 3.12.

Originally discovered by @nedbat #113680 (comment)

CPython versions tested on:

3.12, 3.13

Operating systems tested on:

No response

Metadata

Metadata

Assignees

Labels

type-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions