Mercurial > cpython-lru_cache-weakref
diff Python/getargs.c @ 62221:fe5ed70283ef
Issue #8950: Make PyArg_Parse* with 'L' code raise for float inputs,
instead of warning. This makes it consistent with the other integer
codes.
| author | Mark Dickinson <dickinsm@gmail.com> |
|---|---|
| date | Thu, 10 Jun 2010 16:05:10 +0000 |
| parents | d7113cacd428 |
| children | b32a2816f6e9 |
line wrap: on
line diff
--- a/Python/getargs.c Thu Jun 10 13:36:23 2010 +0000 +++ b/Python/getargs.c Thu Jun 10 16:05:10 2010 +0000 @@ -582,19 +582,6 @@ #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 @@ 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; }
