Message396389
Oh it is also occurring when running from script (I ran it from IDLE and it always results in correct lineno). I wrote example similar to how unittests work and the frame with -1 lineno is also occurring there. Here is the code -
```
class A:
def __enter__(self):
return self
def __exit__(self, *args, **kwargs):
raise Exception("Frame is -1 if program is run from command line")
with A():
raise Exception("Normal Error")
```
Also, unsurprisingly, pdb fails with a "TypeError: '>=' not supported between instances of 'NoneType' and 'int'". Full pdb log -
Traceback (most recent call last):
File "C:\Users\shrey\Desktop\line_negative_one.py", line -1, in <module>
File "C:\github\cpython\lib\bdb.py", line 96, in trace_dispatch
return self.dispatch_exception(frame, arg)
File "C:\github\cpython\lib\bdb.py", line 169, in dispatch_exception
if self.stop_here(frame):
File "C:\github\cpython\lib\bdb.py", line 212, in stop_here
return frame.f_lineno >= self.stoplineno
TypeError: '>=' not supported between instances of 'NoneType' and 'int' |
|
Date |
User |
Action |
Args |
2021-06-23 08:59:12 | shreyanavigyan | set | recipients:
+ shreyanavigyan, gvanrossum, vstinner, Mark.Shannon, Anthony Sottile, pablogsal, domdfcoding |
2021-06-23 08:59:12 | shreyanavigyan | set | messageid: <1624438752.3.0.2378449001.issue44297@roundup.psfhosted.org> |
2021-06-23 08:59:12 | shreyanavigyan | link | issue44297 messages |
2021-06-23 08:59:12 | shreyanavigyan | create | |
|