Message339542
This is not a bug.
On the first pdb session from the OP:
True
--Return--
> <ipython-input-2-9d1238ac9b7a>(5)<module>()->None
-> import pdb; pdb.set_trace()
(Pdb) print("err" in locals())
False <-------------- BUG??
Pdb has stopped on a '--Return--' line event, so we are already outside the scope of the except clause and the 'err' local variable cannot be accessed outside the except block. The following code snippet shows that pdb stops at the line following the set_trace() call:
==================
def foo():
try:
1/0
except Exception as err:
import pdb; pdb.set_trace()
x= 1
foo()
==================
And the corresponding pdb session:
$ python foo.py
> /path/to/foo.py(6)foo()
-> x= 1
(Pdb) err
*** NameError: name 'err' is not defined
(Pdb) |
|
Date |
User |
Action |
Args |
2019-04-06 19:48:02 | xdegaye | set | recipients:
+ xdegaye, barry, SilentGhost, Saim Raza |
2019-04-06 19:48:02 | xdegaye | set | messageid: <1554580082.12.0.893294687173.issue36537@roundup.psfhosted.org> |
2019-04-06 19:48:02 | xdegaye | link | issue36537 messages |
2019-04-06 19:48:01 | xdegaye | create | |
|