[Python-3000] PyInt_ to PyLong_ rename

"Martin v. Löwis" martin at v.loewis.de
Mon Dec 3 21:12:00 CET 2007


>> Sure. However, you could also use _testcapi.PY_SSIZE_T_MAX, or
>> ctypes.sizeof(ctypes.py_object).
> 
> Much less intuitive though.

Actually, I find the ctypes version a more direct answer to the
question "what is the address space?".

>> I'd be in favor of the latter. I never meant the PyInt_CheckExact hack
>> to persist into the release.
> 
> OK. What's needed?

The remaining occurrences of PyInt_CheckExact must be replaced with
PyLong_Check, and the subsequent PyLong_AsLong calls must check for
overflow. There are 22 uses still left. The ones in ceval.c are
quite tricky: it's not clear that the speed-up they originally meant
to provide is still present. The options would be to either continue
special-casing small integers, or to remove the check altogether,
trusting that the binary operator is fast enough (which may actually
involve fewer function calls than the "inline" version).

Regards,
Martin



More information about the Python-3000 mailing list