[docs] [issue17576] PyNumber_Index() is not int-subclass friendly (or operator.index() docos lie)

Serhiy Storchaka report at bugs.python.org
Wed Aug 21 11:33:16 CEST 2013


Serhiy Storchaka added the comment:

Yet some nitpicks.

Currently the code of _PyLong_FromNbInt() is inlined and the do_decref flag is used to prevent needless change refcounts of int objects (see also issue18797). In proposed patch common code is extracted into the _PyLong_FromNbInt() function and int objects increfed and decrefed. Doesn't it affect a performance? PyLong_As* functions used in arguments parsing in a lot of builtins and their .performance is important.

If the patch slowdowns PyLong_As* functions we perhaps should check PyLong_CheckExact() before calling _PyLong_FromNbInt() and use the do_decref flag.

In general the idea and the patch LGTM.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17576>
_______________________________________


More information about the docs mailing list