Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise a Py3K warning when using a float where an int is expected #46596

Closed
brettcannon opened this issue Mar 17, 2008 · 5 comments
Closed

Raise a Py3K warning when using a float where an int is expected #46596

brettcannon opened this issue Mar 17, 2008 · 5 comments
Assignees
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@brettcannon
Copy link
Member

BPO 2343
Nosy @brettcannon, @benjaminp

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/brettcannon'
closed_at = <Date 2008-04-29.02:18:48.112>
created_at = <Date 2008-03-17.18:16:17.533>
labels = ['interpreter-core', 'type-bug']
title = 'Raise a Py3K warning when using a float where an int is expected'
updated_at = <Date 2008-04-29.02:18:48.111>
user = 'https://github.com/brettcannon'

bugs.python.org fields:

activity = <Date 2008-04-29.02:18:48.111>
actor = 'brett.cannon'
assignee = 'brett.cannon'
closed = True
closed_date = <Date 2008-04-29.02:18:48.112>
closer = 'brett.cannon'
components = ['Interpreter Core']
creation = <Date 2008-03-17.18:16:17.533>
creator = 'brett.cannon'
dependencies = []
files = []
hgrepos = []
issue_num = 2343
keywords = ['26backport']
message_count = 5.0
messages = ['63704', '64345', '64348', '64350', '65954']
nosy_count = 2.0
nosy_names = ['brett.cannon', 'benjamin.peterson']
pr_nums = []
priority = 'critical'
resolution = 'out of date'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue2343'
versions = ['Python 2.6']

@brettcannon
Copy link
Member Author

Using a float where an int should only be used (e.g., [].insert(.5, 0)) should raise a Py3K warning.

@brettcannon brettcannon added release-blocker interpreter-core (Objects, Python, Grammar, and Parser dirs) and removed release-blocker labels Mar 17, 2008
@benjaminp
Copy link
Contributor

This is already implemented:
>>> [].insert(.5, 0)
__main__:1: DeprecationWarning: integer argument expected, got float

@brettcannon
Copy link
Member Author

Is there any other place where this might be an issue? That's the real
question; are all reasonable cases covered.

@benjaminp
Copy link
Contributor

I think so. The warning is implemented in getargs.c, so any conversion
from a float to int will result in a warning.

@benjaminp benjaminp added the type-bug An unexpected behavior, bug, or error label Mar 22, 2008
@brettcannon brettcannon self-assigned this Mar 23, 2008
@brettcannon
Copy link
Member Author

Closing as out of date since it seems to have already been handled.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants