Enji Cooper <yaneurab...@gmail.com> added the comment:

> The reason why there was the PyInt_AS_LONG macro is that it is very simple 
> and efficient. It never fails, because the value of the int object always 
> fits in the C long. PyInt_AsLong is much slower. If you know that the object 
> is int, you can use PyInt_AS_LONG for performance and simplicity.

Another note: this assertion holds generally true with contemporary hardware 
architectures (sizeof(long long) != sizeof(int)), but there are still 32-bit 
hardware/software architectures (ex: non-ARM64 capable ARM arches, i386, 
powerpc 32-bit, etc) that violate this constraint. 32-bit architectures are at 
risk of overflow with 32-bit values.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39762>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to