Issue 2343: Raise a Py3K warning when using a float where an int is expected (original) (raw)

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/46596

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:31 admin set github: 46596
2008-04-29 02🔞48 brett.cannon set status: open -> closedresolution: out of datemessages: +
2008-03-23 02:41:56 brett.cannon set assignee: brett.cannon
2008-03-22 23:44:32 benjamin.peterson set type: behavior
2008-03-22 23:43:48 benjamin.peterson set messages: +
2008-03-22 23:34:00 brett.cannon set messages: +
2008-03-22 23:12:26 benjamin.peterson set nosy: + benjamin.petersonmessages: +
2008-03-17 20:11:48 brett.cannon set priority: release blocker -> critical
2008-03-17 18:16:17 brett.cannon create