[Python-3000] C API for ints and strings (original) (raw)

"Martin v. Löwis" martin at v.loewis.de
Sat Sep 8 19:27:11 CEST 2007


Why is PyLongFitsInLong private? I don't know; perhaps because it doesn't always give the best answer.

Its sole purpose is to support PyInt_CheckExact. There is some code that relies that after PyInt_CheckExact succeeds, it is safe to do PyInt_AsLong. When I defined PyInt_CheckExact to PyLong_CheckExact, such code would break. Adding this "conservative" estimate allowed that code to work when the macro was true. As this occurs in some time-critical places, I did not want to waste time with computing a correct result.

Regards, Martin



More information about the Python-3000 mailing list