mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
gh-125096: Don't import _pyrepl in site if PYTHON_BASIC_REPL (#125097)
If the PYTHON_BASIC_REPL environment variable is set, the site module no longer imports the _pyrepl module. Moreover, the site module now respects -E and -I command line options: ignore PYTHON_BASIC_REPL in this case.
This commit is contained in:
parent
5967dd8a4d
commit
65ce228d63
3 changed files with 36 additions and 7 deletions
|
@ -1204,6 +1204,18 @@ class TestMain(ReplTestCase):
|
|||
self.assertNotIn("Exception", output)
|
||||
self.assertNotIn("Traceback", output)
|
||||
|
||||
# The site module must not load _pyrepl if PYTHON_BASIC_REPL is set
|
||||
commands = ("import sys\n"
|
||||
"print('_pyrepl' in sys.modules)\n"
|
||||
"exit()\n")
|
||||
env["PYTHON_BASIC_REPL"] = "1"
|
||||
output, exit_code = self.run_repl(commands, env=env)
|
||||
self.assertEqual(exit_code, 0)
|
||||
self.assertIn("False", output)
|
||||
self.assertNotIn("True", output)
|
||||
self.assertNotIn("Exception", output)
|
||||
self.assertNotIn("Traceback", output)
|
||||
|
||||
@force_not_colorized
|
||||
def test_bad_sys_excepthook_doesnt_crash_pyrepl(self):
|
||||
env = os.environ.copy()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue