Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

SystemExit raised byPYTHONSTARTUP can prevent the REPL from starting #143023

Open
Labels
3.13bugs and security fixes3.14bugs and security fixes3.15new features, bugs and security fixesextension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error
@johnslavik

Description

@johnslavik

Bug report

Bug description:

To reproduce:

  1. The new REPL
❯ PYTHONSTARTUP=<(echo'raise SystemExit') ./pythonPython 3.15.0a3+ (heads/main:5b5263648f2, Dec 20 2025, 07:19:41) [GCC 15.2.1 20250808 (Red Hat 15.2.1-1)] on linuxType"help","copyright","credits" or"license"for more information.
  1. The basic REPL
❯ PYTHON_BASIC_REPL=1 PYTHONSTARTUP=<(echo'raise SystemExit') ./pythonPython 3.15.0a3+ (heads/main:5b5263648f2, Dec 20 2025, 07:19:41) [GCC 15.2.1 20250808 (Red Hat 15.2.1-1)] on linuxType"help","copyright","credits" or"license"for more information.

(both actually hit the same code path --Py_RunMain ->pymain_run_python ->pymain_run_stdin ->pymain_run_startup ->_PyRun_SimpleFileObject ->PyErr_Print ->PyErr_PrintEx ->_PyErr_PrintEx ->handle_system_exit)

While this is largely an edge case of the regular REPLs, copying this semantics just feels wrong in Python code.
I've run into this while addingPYTHONSTARTUP exception handling to the asyncio REPL inGH-140288.

Should I be keeping asyncio REPL in parity with Python-side REPLs behavior in this regard?
Do we want to fix this in the C code?

And lastly, as part of this issue we would document the exception handling ofPYTHONSTARTUP.

@ZeroIntensitystdlibinterpreter-coredocstopic-repl3.133.143.15

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixes3.15new features, bugs and security fixesextension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp