Skip to content

Commit 77a19c8

Browse files
[3.13] gh-149319: Make asyncio REPL respect -I and -E options (GH-149405) (#154073)
gh-149319: Make `asyncio` REPL respect `-I` and `-E` options (GH-149405) (cherry picked from commit 7f8fc07) Co-authored-by: Jonathan Dung <jonathandung@yahoo.com>
1 parent 9c0764d commit 77a19c8

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

Lib/asyncio/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def run(self):
9494

9595
console.write(banner)
9696

97-
if not sys.flags.isolated and (startup_path := os.getenv("PYTHONSTARTUP")):
97+
if not sys.flags.ignore_environment and (startup_path := os.getenv("PYTHONSTARTUP")):
9898
sys.audit("cpython.run_startup", startup_path)
9999
try:
100100
import tokenize
@@ -148,7 +148,7 @@ def interrupt(self) -> None:
148148
if __name__ == '__main__':
149149
sys.audit("cpython.run_stdin")
150150

151-
if os.getenv('PYTHON_BASIC_REPL'):
151+
if not sys.flags.ignore_environment and os.getenv('PYTHON_BASIC_REPL'):
152152
CAN_USE_PYREPL = False
153153
else:
154154
from _pyrepl.main import CAN_USE_PYREPL
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The :mod:`asyncio` REPL now ignores :envvar:`PYTHONSTARTUP` and :envvar:`PYTHON_BASIC_REPL` when :option:`-E` or :option:`-I` is used. Patch by Jonathan Dung.

0 commit comments

Comments
 (0)