You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Wrong traceback for AssertionError while running under pdb #79586
bpo-16482: pdb.set_trace() clobbering traceback on error
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2018-12-04.16:32:14.269>created_at=<Date2018-12-04.10:17:13.643>labels= ['3.7', '3.8', 'type-bug', 'library']
title='Wrong traceback for AssertionError while running under pdb'updated_at=<Date2018-12-04.16:32:14.268>user='https://github.com/tirkarthi'
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
importpdb; pdb.set_trace();
assert 1 == 1
foriinrange(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>assert1==1
AssertionError
Thanks Serhiy, is this a known behavior or issue since it's from 2.7 ? This is highly confusing and misleading as in your example and also while debugging tests that fail at a different line of assertion statement from the current line in pdb which might also be a different assert statement.
Seems this is a known issue and has an open PR #6233 . I checked out the PR locally and it works fine on the examples presented though has merge conflicts with master. I am closing it as duplicate of bpo-16482 that links to other possible issues.
Activity
tirkarthi commentedon Dec 4, 2018
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
assert 1 == 1
assert 1 == 2
# Executing on master
serhiy-storchaka commentedon Dec 4, 2018
There is nothing specific for assert and AssertionError. Other example:
tirkarthi commentedon Dec 4, 2018
Thanks Serhiy, is this a known behavior or issue since it's from 2.7 ? This is highly confusing and misleading as in your example and also while debugging tests that fail at a different line of assertion statement from the current line in pdb which might also be a different assert statement.
tirkarthi commentedon Dec 4, 2018
Seems this is a known issue and has an open PR #6233 . I checked out the PR locally and it works fine on the examples presented though has merge conflicts with master. I am closing it as duplicate of bpo-16482 that links to other possible issues.