[issue14376] sys.exit documents argument as "integer" but actually requires "subtype of int"

2017-02-02 Thread Roundup Robot
Changes by Roundup Robot : ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue14376] sys.exit documents argument as "integer" but actually requires "subtype of int"

2017-02-02 Thread Roundup Robot
Changes by Roundup Robot : ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue14376] sys.exit documents argument as "integer" but actually requires "subtype of int"

2017-02-02 Thread Roundup Robot
Changes by Roundup Robot : ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue14376] sys.exit documents argument as "integer" but actually requires "subtype of int"

2017-02-02 Thread Roundup Robot
Roundup Robot added the comment: New changeset 12b49507177368204085bd6e2b464f45e3b569e2 by Mark Dickinson in branch '2.7': Issue #14376: sys.exit now accepts longs as well as ints. Thanks Gareth Rees. https://github.com/python/cpython/commit/12b49507177368204085bd6e2b464f45e3b569e2

[issue14376] sys.exit documents argument as "integer" but actually requires "subtype of int"

2017-02-02 Thread Gareth Rees
Gareth Rees added the comment: Thank you, Mark (and everyone else who helped). -- ___ Python tracker ___ ___

[issue14376] sys.exit documents argument as "integer" but actually requires "subtype of int"

2017-02-02 Thread Mark Dickinson
Changes by Mark Dickinson : -- assignee: -> mark.dickinson resolution: -> fixed stage: test needed -> resolved status: open -> closed ___ Python tracker

[issue14376] sys.exit documents argument as "integer" but actually requires "subtype of int"

2017-02-02 Thread Roundup Robot
Roundup Robot added the comment: New changeset 14682d00b09a by Mark Dickinson in branch '2.7': Issue #14376: sys.exit now accepts longs as well as ints. Thanks Gareth Rees. https://hg.python.org/cpython/rev/14682d00b09a -- nosy: +python-dev ___

[issue14376] sys.exit documents argument as "integer" but actually requires "subtype of int"

2017-02-01 Thread Gareth Rees
Gareth Rees added the comment: Thanks for the revised patch, Mark. The new tests look good. -- ___ Python tracker ___

[issue14376] sys.exit documents argument as "integer" but actually requires "subtype of int"

2017-02-01 Thread Mark Dickinson
Mark Dickinson added the comment: The test portion of the existing patch doesn't apply cleanly to 2.7 tip. Here's an updated patch that does, with slightly expanded tests and a Misc/NEWS entry. There was discussion above about two overflow cases: C long to C int, and C int to byte, but with

[issue14376] sys.exit documents argument as "integer" but actually requires "subtype of int"

2017-02-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Count me as +1. The patch LGTM. See also issue28998. -- ___ Python tracker ___

[issue14376] sys.exit documents argument as "integer" but actually requires "subtype of int"

2017-02-01 Thread Gareth Rees
Gareth Rees added the comment: In Windows, under cmd.exe, you can use %errorlevel% -- ___ Python tracker ___

[issue14376] sys.exit documents argument as "integer" but actually requires "subtype of int"

2017-02-01 Thread Terry J. Reedy
Terry J. Reedy added the comment: Summary of overt and implied votes: Core Devs: +1 Mark Dickenson +1 Ethan Furman ?? Serhiy Storchaka -1 Alexander Belopolsky (at first, but unclear after) Other: +1 Ryan Gonzales, quoting Guido about equivalence of ints and longs. The sys.exit docstring says

[issue14376] sys.exit documents argument as "integer" but actually requires "subtype of int"

2017-02-01 Thread Gareth Rees
Gareth Rees added the comment: Is there any chance of making progress on this issue? Is there anything wrong with my patch? Did I omit any relevant point in my message of 2016-06-11 16:26? It would be nice if this were not left in limbo for another four years. --

[issue14376] sys.exit documents argument as "integer" but actually requires "subtype of int"

2016-08-27 Thread Lucas Hoffmann
Changes by Lucas Hoffmann : -- nosy: +luc ___ Python tracker ___ ___ Python-bugs-list mailing

[issue14376] sys.exit documents argument as "integer" but actually requires "subtype of int"

2016-06-11 Thread Gareth Rees
Gareth Rees added the comment: Let's not allow the perfect to be the enemy of the good here. The issue I reported is a very specific one: in Python 2.7, if you pass a long to sys.exit, then the value of the long is not used as the exit code. This is bad because functions like os.spawnv that

[issue14376] sys.exit documents argument as integer but actually requires subtype of int

2015-07-21 Thread Ethan Furman
Changes by Ethan Furman et...@stoneleaf.us: -- nosy: -ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14376 ___ ___ Python-bugs-list

[issue14376] sys.exit documents argument as integer but actually requires subtype of int

2015-05-02 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14376 ___

[issue14376] sys.exit documents argument as integer but actually requires subtype of int

2015-04-24 Thread Ethan Furman
Ethan Furman added the comment: I previously wrote: -- Gareth, please ignore my comments about adding guards on the return value -- it is up to the O/S to use or adjust whatever Python returns. Let me clarify that a bit: we need to protect against overflow from long to int;

[issue14376] sys.exit documents argument as integer but actually requires subtype of int

2015-04-24 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Alexander, create a new issue for the problem of converting non-zero values to zero. See #24052. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14376

[issue14376] sys.exit documents argument as integer but actually requires subtype of int

2015-04-23 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I am -1 on the patch. (int)PyLong_AsLong(value) can silently convert non-zero error code to zero. I would leave 2.7 as is and limit allowable values to a range supported by the platform. Note that ANSI C standard only specifies two values:

[issue14376] sys.exit documents argument as integer but actually requires subtype of int

2015-04-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There are _PyInt_AsInt() and _PyLong_AsInt(). -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14376 ___

[issue14376] sys.exit documents argument as integer but actually requires subtype of int

2015-04-23 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: The key issue here is not to report success for nonzero values. I consider the following a bug: $ python3 Python 3.4.2 (default, Oct 30 2014, 08:51:12) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.54)] on darwin Type help, copyright, credits or

[issue14376] sys.exit documents argument as integer but actually requires subtype of int

2015-04-23 Thread Ryan Gonzalez
Ryan Gonzalez added the comment: Now we're getting away from the original issue. This wasn't created to handle edge cases for sys.exit; is was created to make it accept long values under Python 2. -- nosy: +Ryan.Gonzalez ___ Python tracker

[issue14376] sys.exit documents argument as integer but actually requires subtype of int

2015-04-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The key issue here is not to report success for nonzero values. This is different issue. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14376 ___

[issue14376] sys.exit documents argument as integer but actually requires subtype of int

2015-04-23 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: errors should not pass silently The fix makes the problem worse. Why would anyone want to pass a long integer to exit? I bet the user who discovered this problem had something like 0L or 1L coming from a lazily written C extension. --

[issue14376] sys.exit documents argument as integer but actually requires subtype of int

2015-04-23 Thread Ethan Furman
Ethan Furman added the comment: +1 for the fix. Alexander, create a new issue for the problem of converting non-zero values to zero. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14376

[issue14376] sys.exit documents argument as integer but actually requires subtype of int

2015-04-23 Thread Ethan Furman
Changes by Ethan Furman et...@stoneleaf.us: -- nosy: +ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14376 ___ ___ Python-bugs-list

[issue14376] sys.exit documents argument as integer but actually requires subtype of int

2015-04-23 Thread Ethan Furman
Ethan Furman added the comment: Linux is not the only O/S that Python runs on. There should be no difference between int and long. Possible doc fix being tracked in issue24045. Gareth, please ignore my comments about adding guards on the return value -- it is up to the O/S to use or adjust

[issue14376] sys.exit documents argument as integer but actually requires subtype of int

2015-04-23 Thread Ryan Gonzalez
Ryan Gonzalez added the comment: errors should not pass silently The fix makes the problem worse. Why would anyone want to pass a long integer to exit? I bet the user who discovered this problem had something like 0L or 1L coming from a lazily written C extension. Or the person is

[issue14376] sys.exit documents argument as integer but actually requires subtype of int

2015-04-23 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Passing anything other than one of the os.EX_* constants to sys.exit() is a bad idea. In most cases you can get away with 0 and ±1. Anything beyond 8 bit signed range is a gamble. Passing a computed integer value is even more problematic. With the

[issue14376] sys.exit documents argument as integer but actually requires subtype of int

2014-02-04 Thread Gareth Rees
Gareth Rees added the comment: Patch attached. I added a test case to Lib/test/test_sys.py. -- Added file: http://bugs.python.org/file33906/exit.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14376

[issue14376] sys.exit documents argument as integer but actually requires subtype of int

2012-03-24 Thread Terry J. Reedy
Terry J. Reedy tjre...@udel.edu added the comment: Patch in first message; patch file needed. I don't know if sys.exit is actually tested. This is really 2.7 specific. -- keywords: +patch nosy: +terry.reedy stage: - test needed ___ Python tracker

[issue14376] sys.exit documents argument as integer but actually requires subtype of int

2012-03-21 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: It would be simple to change line 1112 of pythonrun.c from if (PyInt_Check(value)) to if (PyInt_Check(value) || PyLong_Check(value)) Wouldn't you also have to deal with possible errors from the PyInt_AsLong call? E.g., after

[issue14376] sys.exit documents argument as integer but actually requires subtype of int

2012-03-21 Thread Gareth Rees
Gareth Rees g...@garethrees.org added the comment: Wouldn't you also have to deal with possible errors from the PyInt_AsLong call? Good point. But I note that Python 3 just does exitcode = (int)PyLong_AsLong(value); so maybe it's not important to do error handling here. --

[issue14376] sys.exit documents argument as integer but actually requires subtype of int

2012-03-21 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: so maybe it's not important to do error handling here. Hmm, seems it's not. And dealing with OverflowError is hardly likely to be a concern in practice anyway. +1 for the suggested fix. -- ___

[issue14376] sys.exit documents argument as integer but actually requires subtype of int

2012-03-21 Thread Éric Araujo
Changes by Éric Araujo mer...@netwok.org: -- versions: -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14376 ___ ___ Python-bugs-list

[issue14376] sys.exit documents argument as integer but actually requires subtype of int

2012-03-20 Thread Gareth Rees
New submission from Gareth Rees g...@garethrees.org: The documentation for sys.exit says, The optional argument arg can be an integer giving the exit status (defaulting to zero), or another type of object. However, the arguments that are treated as exit statuses are actually subtypes of int.