[issue21111] PyLong_AsUnsignedLongAndOverflow does not exist
STINNER Victor
report at bugs.python.org
Mon Apr 7 11:29:23 CEST 2014
STINNER Victor added the comment:
> > P.P.S.: Just a random idea: would it be a to rewrite PyLong to use GMP instead as a PyVarObject of mp_limb_t's?
> I'll let Victor answer that one. :-) In the mean time, see issue 1814.
During the development of Python 3.0, I wrote a large patch to reuse directly GMP for Python int. My conclusion is here:
http://bugs.python.org/issue1814#msg77018
(hint: "it's not a good idea")
IMO the first problem is the memory allocation. GMP type doesn't fit well with Python type. GMP type for "int" has a fixed size, and then GMP allocates a second structure for digits. It's inefficient for small integers, and almost all Python int are small (smaller than 32 or 64 bits).
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21111>
_______________________________________
More information about the Python-bugs-list
mailing list