summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-06-10 16:05:10 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2010-06-10 16:05:10 (GMT)
commitc73013127b2791476ade69d36b69736b9caa674c (patch)
treefa53dc8035ac44a9b1bb73d06ed964928a4a9919 /Python
parent37296e89a5119eb3af8344796ce653b2d89e403a (diff)
downloadcpython-c73013127b2791476ade69d36b69736b9caa674c.zip
cpython-c73013127b2791476ade69d36b69736b9caa674c.tar.gz
cpython-c73013127b2791476ade69d36b69736b9caa674c.tar.bz2
Issue #8950: Make PyArg_Parse* with 'L' code raise for float inputs,
instead of warning. This makes it consistent with the other integer codes.
Diffstat (limited to 'Python')
-rw-r--r--Python/getargs.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index 2a26a8f..127b147 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -582,19 +582,6 @@ converterr(const char *expected, PyObject *arg, char *msgbuf, size_t bufsize)
#define CONV_UNICODE "(unicode conversion error)"
-/* explicitly check for float arguments when integers are expected. For now
- * signal a warning. Returns true if an exception was raised. */
-static int
-float_argument_warning(PyObject *arg)
-{
- if (PyFloat_Check(arg) &&
- PyErr_Warn(PyExc_DeprecationWarning,
- "integer argument expected, got float" ))
- return 1;
- else
- return 0;
-}
-
/* Explicitly check for float arguments when integers are expected.
Return 1 for error, 0 if ok. */
static int
@@ -791,14 +778,13 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
case 'L': {/* PY_LONG_LONG */
PY_LONG_LONG *p = va_arg( *p_va, PY_LONG_LONG * );
PY_LONG_LONG ival;
- if (float_argument_warning(arg))
+ if (float_argument_error(arg))
return converterr("long<L>", arg, msgbuf, bufsize);
ival = PyLong_AsLongLong(arg);
- if (ival == (PY_LONG_LONG)-1 && PyErr_Occurred() ) {
+ if (ival == (PY_LONG_LONG)-1 && PyErr_Occurred())
return converterr("long<L>", arg, msgbuf, bufsize);
- } else {
+ else
*p = ival;
- }
break;
}