Author larry
Recipients georg.brandl, larry, mark.dickinson, serhiy.storchaka, skrah
Date 2014-01-16.02:36:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1389839767.37.0.7190810646.issue20260@psf.upfronthosting.co.za>
In-reply-to
Content
I'm glad you caught that!  First things first: the converted code should behave identically to the existing code, including raising the same exceptions.


If you examine the exception hierarchy:
    http://docs.python.org/3.4/library/exceptions.html#exception-hierarchy

you'll see that "OverflowError" is a subclass of "ArithmeticError".  In other words, it represents when you perform an arithmetic operation that overflows the result type.  Using it to also represent "you specified a value that is out of range for this conversion" seems wrong.

So I like #3 as well.

Could _PyLong_UnsignedInt_Converter catch the OverflowError raised by PyLong_AsUnsignedLong and reraise it as ValueError?
History
Date User Action Args
2014-01-16 02:36:07larrysetrecipients: + larry, georg.brandl, mark.dickinson, skrah, serhiy.storchaka
2014-01-16 02:36:07larrysetmessageid: <1389839767.37.0.7190810646.issue20260@psf.upfronthosting.co.za>
2014-01-16 02:36:07larrylinkissue20260 messages
2014-01-16 02:36:06larrycreate