[Python-3000] int-long unification
Nick Coghlan
ncoghlan at gmail.com
Mon Aug 21 12:03:46 CEST 2006
Martin v. Löwis wrote:
> Guido van Rossum schrieb:
>> Are you interested in doing this at the Google sprint next week?
>
> Sure; I hadn't any special plans so far.
>
>> What do you think?
>
> Sounds good. There are two problems I see:
>
> - how to benchmark?
>
> - there are subtle details in the API that require changes
> to extension code. In particular, PyInt_AsLong currently
> cannot fail, but can fail with a range error after the
> unification.
PyInt_AsLong can already fail with OverflowError - pass it a PyLong object and
it will try to convert it using the nb_int slot and PyLong_AsLong.
PyInt_AsLong is actually somewhat misnamed - it is really PyNumber_AsLong,
since it accepts arbitrary objects and coerces them to integers via __int__,
instead of just accepting PyInt instances.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
More information about the Python-3000
mailing list