Skip to content

Commit 89191d7

Browse files
committed
fixup! fixup! Fix repl
1 parent d4090e9 commit 89191d7

File tree

3 files changed

+2
-4
lines changed

3 files changed

+2
-4
lines changed

Lib/_pyrepl/console.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from abc import ABC, abstractmethod
2525
import ast
2626
import code
27+
import linecache
2728
from dataclasses import dataclass, field
2829
import os.path
2930
import sys
@@ -193,6 +194,7 @@ def runsource(self, source, filename="<input>", symbol="single"):
193194
item = wrapper([stmt])
194195
try:
195196
code = self.compile.compiler(item, filename, the_symbol)
197+
linecache._register_code(code, source, filename)
196198
except SyntaxError as e:
197199
if e.args[0] == "'await' outside function":
198200
python = os.path.basename(sys.executable)

Lib/_pyrepl/simple_interact.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
from __future__ import annotations
2727

2828
import _sitebuiltins
29-
import linecache
3029
import functools
3130
import os
3231
import sys
@@ -148,7 +147,6 @@ def maybe_run_command(statement: str) -> bool:
148147
continue
149148

150149
input_name = f"<python-input-{input_n}>"
151-
linecache._register_code(input_name, statement, "<stdin>") # type: ignore[attr-defined]
152150
more = console.push(_strip_final_indent(statement), filename=input_name, _symbol="single") # type: ignore[call-arg]
153151
assert not more
154152
input_n += 1

Lib/test/test_capi/test_exceptions.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ def foo():
8585
warnings = proc.err.splitlines()
8686
self.assertEqual(warnings, [
8787
b'<string>:6: RuntimeWarning: Testing PyErr_WarnEx',
88-
b' foo() # line 6',
8988
b'<string>:9: RuntimeWarning: Testing PyErr_WarnEx',
90-
b' foo() # line 9',
9189
])
9290

9391
def test_warn_during_finalization(self):

0 commit comments

Comments
 (0)