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

On current main (after applying PEP 669) the tracing behavior changed and can notify about the same line more than once. #103471

Closed
Assignees
markshannon
Labels
type-bugAn unexpected behavior, bug, or error
@fabioz

Description

@fabioz

The test case for this is below (it works for Python 3.11 and fails in the current master).

import sysimport unittestclass TestSetLocalTrace(unittest.TestCase):    def test_with_branches(self):        def tracefunc(frame, event, arg):            if frame.f_code.co_name == "func":                frame.f_trace = None                frame.f_trace = tracefunc                line = frame.f_lineno - frame.f_code.co_firstlineno                events.append((line, event))            return tracefunc        def func(arg=1):            N = 1            if arg >= 2:                not_reached = 3            else:                reached = 5            if arg >= 3:                not_reached = 7            else:                reached = 9            the_end = 10        EXPECTED_EVENTS = [            (0, 'call'),            (1, 'line'),            (2, 'line'),            (5, 'line'),            (6, 'line'),            (9, 'line'),            (10, 'line'),            (10, 'return'),        ]        events = []        sys.settrace(tracefunc)        sys._getframe().f_trace = tracefunc        func()        self.assertEqual(events, EXPECTED_EVENTS)        sys.settrace(None)

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


    [8]ページ先頭

    ©2009-2025 Movatter.jp