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.

classification
Title: PyLong_ API cleanup
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Deprecate implicit truncating when convert Python numbers to C integers: use __index__, not __int__
View: 36048
Assigned To: Nosy List: BTaskaya, erik.bray, lemburg, mark.dickinson, serhiy.storchaka, stutzbach
Priority: normal Keywords:

Created on 2017-12-28 10:19 by erik.bray, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (5)
msg309119 - (view) Author: Erik Bray (erik.bray) * (Python triager) Date: 2017-12-28 10:19
Per Serhiy's comment in this thread https://mail.python.org/pipermail/python-ideas/2017-December/048413.html (which I agree with), several of the PyLong_ functions have behavior carried over from Python 2 of calling __int__ on their arguments if the input is not a PyLongObject:

PyLong_AsLong
PyLong_AsLongAndOverflow
PyLong_AsLongLong
PyLong_AsLongLongAndOverflow
PyLong_AsUnsignedLongMask
PyLong_AsUnsignedLongLongMask

This behavior should probably be deprecated, and eventually removed.  Interfaces that should accept generic number-like objects should use the PyNumber API instead.
msg309136 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-12-28 17:59
See also issue17576. And there may be other related issues.
msg358934 - (view) Author: Batuhan Taskaya (BTaskaya) * (Python committer) Date: 2019-12-28 08:43
Is this related/resolved with issue 36048?
msg358942 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2019-12-28 12:38
@Batuhan: I think so, yes; at least, the "deprecated" part is done. The "eventually removed" is not, and I don't know whether we have a target version for that removal.
msg358944 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2019-12-28 12:44
Closing as a duplicate of #36048 (which isn't quite right, since this issue came first, but it's probably close enough).
History
Date User Action Args
2022-04-11 14:58:56adminsetgithub: 76619
2019-12-28 12:44:53mark.dickinsonsetstatus: open -> closed
superseder: Deprecate implicit truncating when convert Python numbers to C integers: use __index__, not __int__
messages: + msg358944

resolution: duplicate
stage: resolved
2019-12-28 12:38:16mark.dickinsonsetmessages: + msg358942
2019-12-28 08:43:06BTaskayasetnosy: + BTaskaya
messages: + msg358934
2017-12-28 17:59:44serhiy.storchakasetnosy: + mark.dickinson, stutzbach, serhiy.storchaka, lemburg

messages: + msg309136
versions: + Python 3.7
2017-12-28 10:19:25erik.braycreate