-
-
Notifications
You must be signed in to change notification settings - Fork 34k
Closed as not planned
Labels
3.11only security fixesonly security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)triagedThe issue has been accepted as valid by a triager.The issue has been accepted as valid by a triager.type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
If you try to debug code example with pdb and step forward 9 times then pdb stops on 12 line (but it shouldn't go to if statement).
It happens because function trace_dispatch(self, frame, event, arg) gets line event.
Code example (main.py):
def example(i):
match i % 4:
case 0:
if i > 10:
return 0
case 1:
if i > 10:
return 1
case 2:
if i > 10:
print(f'{i}, {i > 10}')
return 2
case 3:
if i > 10:
return 3
if __name__ == '__main__':
print(example(2))
Steps:
python3 -m pdb main.py
> main.py(1)<module>()
-> def example(i):
(Pdb) s
> main.py(18)<module>()
-> if __name__ == '__main__':
(Pdb) s
> main.py(19)<module>()
-> print(example(2))
(Pdb) s
--Call--
> main.py(1)example()
-> def example(i):
(Pdb) s
> main.py(2)example()
-> match i % 4:
(Pdb) s
> main.py(3)example()
-> case 0:
(Pdb) s
> main.py(6)example()
-> case 1:
(Pdb) s
> main.py(9)example()
-> case 2:
(Pdb) s
> main.py(10)example()
-> if i > 10:
(Pdb) s
> main.py(12)example()
-> return 2
...
Environment
Python versions: 3.10, 3.11
OS: MacOS Monterey
CPU: Intel Core i9 2.3 GHz
Metadata
Metadata
Assignees
Labels
3.11only security fixesonly security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)triagedThe issue has been accepted as valid by a triager.The issue has been accepted as valid by a triager.type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error