New submission from Karthikeyan Singaravelan <tir.kar...@gmail.com>:

While running under pdb when I have an assertion error after the command 
continue then  the assertion error is mentioned with the statement under which 
I have executed continue command in pdb. Below script has an assertion error on 
assert 1 == 2 but when I execute continue from assert 1 == 1 then it shows the 
line assert 1 == 1 with the AssertionError. I first noticed this with unittest 
but seems to be a general issue with assert. This is confusing while debugging 
unittest failures. 

I searched for issues but couldn't find a related one and this exists on master 
and 2.7. I assume this is a case where AssertionError doesn't use the current 
line and uses the one where pdb is executed with continue? I don't know if this 
is an issue with pdb or assert so I am adding Library as the component.

# Reproducible script

import pdb; pdb.set_trace();

assert 1 == 1

for i in range(10):
    pass

assert 1 == 2

# Executing on master

➜  cpython git:(master) $ ./python.exe /tmp/foo.py
> /tmp/foo.py(3)<module>()
-> assert 1 == 1
(Pdb) c
Traceback (most recent call last):
  File "/tmp/foo.py", line 3, in <module>
    assert 1 == 1
AssertionError

----------
components: Library (Lib)
messages: 331025
nosy: xtreak
priority: normal
severity: normal
status: open
title: Wrong traceback for AssertionError while running under pdb
type: behavior
versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35405>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to