[New-bugs-announce] [issue8950] In getargs.c, make 'L' code raise TypeError for float arguments.
Mark Dickinson
report at bugs.python.org
Tue Jun 8 23:42:48 CEST 2010
New submission from Mark Dickinson <dickinsm at gmail.com>:
Currently all but one of the integer format codes for getargs.c raise TypeError when passed a float. The 'L' code produces a warning rather than raising an error.
This was deliberate at the time, because all except the 'L' code already raised a DeprecationWarning in Python 3.1, and were converted to raise TypeError for 3.2. Since the 'L' code didn't raise a warning for float inputs in 3.1, directly raising a TypeError in 3.2 seemed a bit abrupt.
However, I'd like to revisit this decision, and make the 'L' code raise a TypeError in 3.2. Note that
(1) The 'L' code represents the Py_LONG_LONG type, and isn't used very much; I think the risk of unexpected breakage from this change is fairly small.
(2) One of the places that the 'L' code *is* used is when parsing strange C types (like off_t) that are matched with either size_t, long or long long at configure + build time. So one platform might end up parsing off_t types with the 'n' code, while another parses them with the 'L' code. It would be desirable for both platforms to have the same behaviour when passed a float.
Any objections to making this change?
See also issue 5080.
----------
assignee: mark.dickinson
components: Interpreter Core
messages: 107352
nosy: haypo, mark.dickinson
priority: normal
severity: normal
status: open
title: In getargs.c, make 'L' code raise TypeError for float arguments.
type: behavior
versions: Python 3.2
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8950>
_______________________________________
More information about the New-bugs-announce
mailing list