This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients ngie, serhiy.storchaka
Date 2020-02-26.20:02:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1582747362.11.0.551756934837.issue39762@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-02-26 20:02:42serhiy.storchakasetrecipients: + serhiy.storchaka, ngie
2020-02-26 20:02:42serhiy.storchakasetmessageid: <1582747362.11.0.551756934837.issue39762@roundup.psfhosted.org>
2020-02-26 20:02:42serhiy.storchakalinkissue39762 messages
2020-02-26 20:02:42serhiy.storchakacreate