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: Raise a Py3K warning when using a float where an int is expected
Type: behavior Stage:
Components: Interpreter Core Versions: Python 2.6
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: brett.cannon Nosy List: benjamin.peterson, brett.cannon
Priority: critical Keywords: 26backport

Created on 2008-03-17 18:16 by brett.cannon, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg63704 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2008-03-17 18:16
Using a float where an int should only be used (e.g., ``[].insert(.5,
0)``) should raise a Py3K warning.
msg64345 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-03-22 23:12
This is already implemented:
>>> [].insert(.5, 0)
__main__:1: DeprecationWarning: integer argument expected, got float
msg64348 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2008-03-22 23:34
Is there any other place where this might be an issue? That's the real 
question; are all reasonable cases covered.
msg64350 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-03-22 23:43
I think so. The warning is implemented in getargs.c, so any conversion
from a float to int will result in a warning.
msg65954 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2008-04-29 02:18
Closing as out of date since it seems to have already been handled.
History
Date User Action Args
2022-04-11 14:56:31adminsetgithub: 46596
2008-04-29 02:18:48brett.cannonsetstatus: open -> closed
resolution: out of date
messages: + msg65954
2008-03-23 02:41:56brett.cannonsetassignee: brett.cannon
2008-03-22 23:44:32benjamin.petersonsettype: behavior
2008-03-22 23:43:48benjamin.petersonsetmessages: + msg64350
2008-03-22 23:34:00brett.cannonsetmessages: + msg64348
2008-03-22 23:12:26benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg64345
2008-03-17 20:11:48brett.cannonsetpriority: release blocker -> critical
2008-03-17 18:16:17brett.cannoncreate