[issue4536] SystemError if invalid arguments passed to range() and step=-1

2009-06-29 Thread Georg Brandl
Georg Brandl added the comment: Seems to be fixed in current 3k head. -- resolution: -> out of date status: open -> closed ___ Python tracker ___ ___

[issue4536] SystemError if invalid arguments passed to range() and step=-1

2008-12-05 Thread Laszlo
Laszlo <[EMAIL PROTECTED]> added the comment: It is changed from PyErr_Clear() to Py_CLEAR(step) because in case someone else makes the same mistake of not checking for an error before calling validate_step() we do not want to hide the error. It is true that if used properly this part will not g

[issue4536] SystemError if invalid arguments passed to range() and step=-1

2008-12-05 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: It's right that the overflow handling path is never never taken: If "step = PyNumber_Index(step)" succeeds, 'step' is (a subclass of) an int, and PyNumber_AsSsize_t cannot fail, not even on low memory conditions, and large figures are c

[issue4536] SystemError if invalid arguments passed to range() and step=-1

2008-12-05 Thread Georg Brandl
Georg Brandl <[EMAIL PROTECTED]> added the comment: Why is the overflow handling changed at all? -- nosy: +georg.brandl ___ Python tracker <[EMAIL PROTECTED]> ___ _

[issue4536] SystemError if invalid arguments passed to range() and step=-1

2008-12-04 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: The new patch is good for me. I added unit tests, someone should review. -- keywords: +needs review stage: -> patch review Added file: http://bugs.python.org/file12235/test_range.patch ___ P

[issue4536] SystemError if invalid arguments passed to range() and step=-1

2008-12-04 Thread Laszlo
Changes by Laszlo <[EMAIL PROTECTED]>: Removed file: http://bugs.python.org/file12226/range.diff ___ Python tracker <[EMAIL PROTECTED]> ___ ___

[issue4536] SystemError if invalid arguments passed to range() and step=-1

2008-12-04 Thread Laszlo
Laszlo <[EMAIL PROTECTED]> added the comment: Oops, sorry I didn't realize validate_step() is supposed to validate the input AND return the converted value. Thanks for the feedback. This new patch should work fine. It retains only the two final points of the previous patch; it doesn't clear the

[issue4536] SystemError if invalid arguments passed to range() and step=-1

2008-12-04 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: The analysis is good, but there are two problems with your patch: - it crashes in debug mode, because a Py_INCREF(step) is missing in validate_step() (A comment above says: "Always returns a new reference") - it does not work with >>

[issue4536] SystemError if invalid arguments passed to range() and step=-1

2008-12-04 Thread Laszlo
New submission from Laszlo <[EMAIL PROTECTED]>: >>> range(1.0, 0, 1) Traceback (most recent call last): File "", line 1, in TypeError: 'float' object cannot be interpreted as an integer >>> range(1.0, 0, -1) Traceback (most recent call last): File "", line 1, in SystemError: NULL result wi