Author serhiy.storchaka
Recipients Oren Milman, rhettinger, serhiy.storchaka
Date 2017-03-18.09:01:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1489827687.14.0.571940989593.issue29834@psf.upfronthosting.co.za>
In-reply-to
Content
_Py_Uid_Converter() in Modules/posixmodule.c is not an example because it calls PyLong_AsUnsignedLong() only for positive integers > LONG_MAX.

PyLong_AsUnsignedLong() is used not much. The motivation of this issue was that if use PyLong_AsUnsignedLong() for converting non-negative by its nature values ValueError can be more appropriate since this limitation is not platform or implementation dependent. Strictly speaking raising OverflowError for negative values doesn't fits the definition of an OverflowError, since the result is not large at all.

I was going to investigate all usages of PyLong_AsUnsignedLong() and if in majority of them ValueError is appropriate and desirable, changing the exception type at that level can make the implementation simpler.
History
Date User Action Args
2017-03-18 09:01:27serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, Oren Milman
2017-03-18 09:01:27serhiy.storchakasetmessageid: <1489827687.14.0.571940989593.issue29834@psf.upfronthosting.co.za>
2017-03-18 09:01:27serhiy.storchakalinkissue29834 messages
2017-03-18 09:01:27serhiy.storchakacreate