[issue36048] Deprecate implicit truncating when convert Python numbers to C integers

STINNER Victor report at bugs.python.org
Wed Feb 20 06:10:59 EST 2019


STINNER Victor <vstinner at redhat.com> added the comment:

I like the idea. Rejecting float but not decimal.Decimal is inconsistent. __index__ has been written explicitly for this purpose.

I'm always confused and lost in subtle details of the Python and C API in how they handle numbers, so I wrote some notes for myself:
https://pythondev.readthedocs.io/numbers.html

Some functions accept only int, others use __int__, others __index__. Some functions silently truncate into 32 or 64-bit signed integer. Some other raise a OverflowError or ValueError...

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36048>
_______________________________________


More information about the Python-bugs-list mailing list