Closed
Description
Initially I just planned to get rid of PyLong_AS_LONG
(undocumented transitional alias of PyLong_AsLong
) in Objects/unicodeobject.c
. But I have used opportunity to add few optimizations in the nearby code. I do not expect significant performance boost, but some overhead was removed in specific corner cases:
PyLong_AsLongAndOverflow
is now only called once for the replacement code (PyLong_AS_LONG
was called twice).- Using
PyMapping_GetOptionalItem
instead ofPyObject_GetItem
allows to avoid raising aKeyError
if the translation table is adict
. I left this case in previous round (Add PyMapping_GetOptionalItem() #106307) because this does not make the code simpler (we still need to handle otherLookupError
), but it still has a tiny performance benefit.