File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -1582,6 +1582,9 @@ def getframeinfo(frame, context=1):
15821582
15831583 lineno = positions [0 ]
15841584
1585+ if lineno is None :
1586+ lineno = 1
1587+
15851588 if not isframe (frame ):
15861589 raise TypeError ('{!r} is not a frame or traceback object' .format (frame ))
15871590
Original file line number Diff line number Diff line change 2828import unittest .mock
2929import warnings
3030import weakref
31+ import inspect
32+ import sys
3133
3234
3335try :
@@ -6250,3 +6252,18 @@ def f():
62506252
62516253if __name__ == "__main__" :
62526254 unittest .main ()
6255+
6256+ def test_getframeinfo_with_exceptiongroup ():
6257+ code = """
6258+ try:
6259+ 1/0
6260+ except* Exception:
6261+ raise
6262+ """
6263+ try :
6264+ exec (code )
6265+ except :
6266+ tb = sys .exc_info ()[2 ]
6267+ while tb :
6268+ info = inspect .getframeinfo (tb .tb_frame )
6269+ tb = tb .tb_next
You can’t perform that action at this time.
0 commit comments