Skip to content

Commit faed11a

Browse files
committed
make inspect work without co_positions
1 parent 53f9992 commit faed11a

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

Lib/inspect.py

+14-8
Original file line numberDiff line numberDiff line change
@@ -1686,19 +1686,22 @@ def getframeinfo(frame, context=1):
16861686
The optional second argument specifies the number of lines of context
16871687
to return, which are centered around the current line."""
16881688
if istraceback(frame):
1689-
positions = _get_code_position_from_tb(frame)
1689+
# XXX: RUSTPYTHON: we don't support _get_code_position yet
1690+
# positions = _get_code_position_from_tb(frame)
16901691
lineno = frame.tb_lineno
16911692
frame = frame.tb_frame
16921693
else:
16931694
lineno = frame.f_lineno
1694-
positions = _get_code_position(frame.f_code, frame.f_lasti)
1695+
# XXX: RUSTPYTHON: we don't support _get_code_position yet
1696+
# positions = _get_code_position(frame.f_code, frame.f_lasti)
16951697

1696-
if positions[0] is None:
1697-
frame, *positions = (frame, lineno, *positions[1:])
1698-
else:
1699-
frame, *positions = (frame, *positions)
1698+
# XXX: RUSTPYTHON: we don't support _get_code_position yet
1699+
# if positions[0] is None:
1700+
# frame, *positions = (frame, lineno, *positions[1:])
1701+
# else:
1702+
# frame, *positions = (frame, *positions)
17001703

1701-
lineno = positions[0]
1704+
# lineno = positions[0]
17021705

17031706
if not isframe(frame):
17041707
raise TypeError('{!r} is not a frame or traceback object'.format(frame))
@@ -1718,7 +1721,10 @@ def getframeinfo(frame, context=1):
17181721
lines = index = None
17191722

17201723
return Traceback(filename, lineno, frame.f_code.co_name, lines,
1721-
index, positions=dis.Positions(*positions))
1724+
index,
1725+
# XXX: RUSTPYTHON: we don't support _get_code_position yet
1726+
# positions=dis.Positions(*positions)
1727+
)
17221728

17231729
def getlineno(frame):
17241730
"""Get the line number from a frame object, allowing for optimization."""

0 commit comments

Comments
 (0)