[issue29833] Avoid raising OverflowError if possible

2018-01-20 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- dependencies: +chr raises OverflowError ___ Python tracker ___

[issue29833] Avoid raising OverflowError if possible

2017-03-18 Thread Raymond Hettinger
Raymond Hettinger added the comment: > I don't expect that any code rely on OverflowError. > ... > As MemoryError, it's not common to catch these exceptions. So why bother making any changes here at all? It seems like an invented problem resulting in unnecessary churn, creating more work for

[issue29833] Avoid raising OverflowError if possible

2017-03-18 Thread STINNER Victor
STINNER Victor added the comment: I don't expect that any code rely on OverflowError. I don't remember any code catching explicitly this exception. As MemoryError, it's not common to catch these exceptions. I expect that Python abstract the hardware if the cost on performance is acceptable.

[issue29833] Avoid raising OverflowError if possible

2017-03-18 Thread Guido van Rossum
Guido van Rossum added the comment: If I had to do it over again I would have used OverflowError only for some very narrowly defined conditions and ValueError for "logical" range limitations. In particular OverflowError suggests that the abstraction is slightly broken (since we usually don't

[issue29833] Avoid raising OverflowError if possible

2017-03-18 Thread Raymond Hettinger
Raymond Hettinger added the comment: IIRC, there have been previous discussions about little inconsistencies between when objects raise an OverflowError versus MemoryError and IndexError, and ValueError. I believe that Guido had opined that the choices were made somewhat arbitrarily (by

[issue29833] Avoid raising OverflowError if possible

2017-03-17 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- dependencies: +Avoid raising OverflowError in len() when __len__() returns negative large value ___ Python tracker

[issue29833] Avoid raising OverflowError if possible

2017-03-17 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- dependencies: +Raise ValueError rather of OverflowError in PyLong_AsUnsignedLong() ___ Python tracker

[issue29833] Avoid raising OverflowError if possible

2017-03-17 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- dependencies: +Avoid raising OverflowError in truncate() if possible, Get rid of C limitation for shift count in right shift, bool of large range raises OverflowError ___ Python tracker

[issue29833] Avoid raising OverflowError if possible

2017-03-17 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: OverflowError usually is caused by platform limitations. It is raised on the fence between Python and C when convert Python integer to C integer type. On other platform the same input can be accepted or cause raising ValueError if the value is out of