[New-bugs-announce] [issue24045] Behavior of large returncodes (sys.exit(nn))

Ethan Furman report at bugs.python.org
Fri Apr 24 02:47:09 CEST 2015


New submission from Ethan Furman:

Not sure if this is a bug, or just One of Those Things:

sys.exit(large_value) can wrap around if the value is too large, but this is O/S dependent.

linux (ubuntu 14.04)

  $ python
  Python 2.7.8 (default, Oct 20 2014, 15:05:29) 
  [GCC 4.9.1] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  --> import sys
  --> sys.exit(256)
  $ echo $?
  0

  $ python
  Python 2.7.8 (default, Oct 20 2014, 15:05:29) 
  [GCC 4.9.1] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  --> import sys
  --> sys.exit(257)
  $ echo $?
  1

M$ (Windows 7)

  > python
  Python 2.7... 
  --> import sys
  --> sys.exit(65535)
  > echo %errorlevel%
  65535

  > python
  Python 2.7...
  --> import sys
  --> sys.exit(100000)
  > echo %errorlevel%
  100000

Perhaps a minor doc update that talks about return codes and why they might not be exactly what was given to Python?

----------
assignee: docs at python
messages: 241903
nosy: docs at python, ethan.furman
priority: normal
severity: normal
status: open
title: Behavior of large returncodes  (sys.exit(nn))
versions: Python 2.7, Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24045>
_______________________________________


More information about the New-bugs-announce mailing list