Shreyan Avigyan <shreyan.avig...@gmail.com> added the comment:
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' ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44297> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com