Skip to content

sys.exit() does not align with document described behavior since 3.13 #129936

Closed as duplicate of#129900
@nukemiko

Description

@nukemiko

Bug report

Bug description:

Passing any non-zero integer to sys.exit() causes Python to exit with exit code 1, regardless of the actual value of passed integer. This is inconsistent with the online documentation description, which does not describe or imply this behavior:

The optional argument arg can be an integer giving the exit status (defaulting to zero), or another type of object. If it is an integer, zero is considered “successful termination” and any nonzero value is considered “abnormal termination” by shells and the like.

Reproduced on Python 3.13.1 (provided by Arch Linux), Python 3.13.2 and 3.14.0a4 (both provided by astral-sh/python-build-standalone). Python 3.12 and lower has not affected.

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtopic-replRelated to the interactive shelltype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions