FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Temporarily revert 492e3e6976d05b8de1892c37c900ada23eaeaf06 for gh-130721 by picnixz · Pull Request #133075 · python/cpython · GitHub

/ cpython Public
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) .rst  (1) All 2 file types selected
Deleted files Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
4 changes: 0 additions & 4 deletions Lib/_pyrepl/__main__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Important: don't add things to this module, as they will end up in the REPL's
# default globals. Use _pyrepl.main instead.

# Avoid caching this file by linecache and incorrectly report tracebacks.
# See https://github.com/python/cpython/issues/129098.
__spec__ = __loader__ = None

if __name__ == "__main__":
from .main import interactive_console as __pyrepl_interactive_console
__pyrepl_interactive_console()
29 changes: 2 additions & 27 deletions Lib/test/test_pyrepl/test_pyrepl.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
from unittest import TestCase, skipUnless, skipIf
from unittest.mock import patch
from test.support import force_not_colorized, make_clean_env
from test.support import SHORT_TIMEOUT, STDLIB_DIR
from test.support import SHORT_TIMEOUT
from test.support.import_helper import import_module
from test.support.os_helper import EnvironmentVarGuard, unlink
from test.support.os_helper import unlink

from .support import (
FakeConsole,
Expand Down Expand Up @@ -1416,31 +1416,6 @@ def test_python_basic_repl(self):
self.assertNotIn("Exception", output)
self.assertNotIn("Traceback", output)

@force_not_colorized
def test_no_pyrepl_source_in_exc(self):
# Avoid using _pyrepl/__main__.py in traceback reports
# See https://github.com/python/cpython/issues/129098.
pyrepl_main_file = os.path.join(STDLIB_DIR, "_pyrepl", "__main__.py")
self.assertTrue(os.path.exists(pyrepl_main_file), pyrepl_main_file)
with open(pyrepl_main_file) as fp:
excluded_lines = fp.readlines()
excluded_lines = list(filter(None, map(str.strip, excluded_lines)))

for filename in ['?', 'unknown-filename', '<foo>', '<...>']:
self._test_no_pyrepl_source_in_exc(filename, excluded_lines)

def _test_no_pyrepl_source_in_exc(self, filename, excluded_lines):
with EnvironmentVarGuard() as env, self.subTest(filename=filename):
env.unset("PYTHON_BASIC_REPL")
commands = (f"eval(compile('spam', {filename!r}, 'eval'))\n"
f"exit()\n")
output, _ = self.run_repl(commands, env=env)
self.assertIn("Traceback (most recent call last)", output)
self.assertIn("NameError: name 'spam' is not defined", output)
for line in excluded_lines:
with self.subTest(line=line):
self.assertNotIn(line, output)

@force_not_colorized
def test_bad_sys_excepthook_doesnt_crash_pyrepl(self):
env = os.environ.copy()
Expand Down

This file was deleted.


Back | FazBrowse Home | New Git URL