Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup! fixup! Fix repl
  • Loading branch information
pablogsal committed Feb 16, 2025
commit 89191d73172cd6b59c3019dd70372a8587fb635b
2 changes: 2 additions & 0 deletions Lib/_pyrepl/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from abc import ABC, abstractmethod
import ast
import code
import linecache
from dataclasses import dataclass, field
import os.path
import sys
Expand Down Expand Up @@ -193,6 +194,7 @@ def runsource(self, source, filename="<input>", symbol="single"):
item = wrapper([stmt])
try:
code = self.compile.compiler(item, filename, the_symbol)
linecache._register_code(code, source, filename)
except SyntaxError as e:
if e.args[0] == "'await' outside function":
python = os.path.basename(sys.executable)
Expand Down
2 changes: 0 additions & 2 deletions Lib/_pyrepl/simple_interact.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from __future__ import annotations

import _sitebuiltins
import linecache
import functools
import os
import sys
Expand Down Expand Up @@ -148,7 +147,6 @@ def maybe_run_command(statement: str) -> bool:
continue

input_name = f"<python-input-{input_n}>"
linecache._register_code(input_name, statement, "<stdin>") # type: ignore[attr-defined]
more = console.push(_strip_final_indent(statement), filename=input_name, _symbol="single") # type: ignore[call-arg]
assert not more
input_n += 1
Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test_capi/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ def foo():
warnings = proc.err.splitlines()
self.assertEqual(warnings, [
b'<string>:6: RuntimeWarning: Testing PyErr_WarnEx',
b' foo() # line 6',
b'<string>:9: RuntimeWarning: Testing PyErr_WarnEx',
b' foo() # line 9',
])

def test_warn_during_finalization(self):
Expand Down