Serhiy Storchaka <storchaka+cpyt...@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.

In contrary, converting the long object to the C long value requires a loop and 
it can overflow. There is no reason to implement it as a macro. You can use the 
PyLong_AsLong function.

----------

_______________________________________
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