mirror of
https://github.com/python/cpython.git
synced 2025-09-01 22:47:59 +00:00
bpo-29695: Deprecated using bad named keyword arguments in builtings: (#486)
int(), bool(), float(), list() and tuple(). Specify the value as a positional argument instead.
This commit is contained in:
parent
d31b28e16a
commit
58d23e6806
12 changed files with 65 additions and 2 deletions
|
@ -1569,6 +1569,12 @@ float_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
return float_subtype_new(type, args, kwds); /* Wimp out */
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:float", kwlist, &x))
|
||||
return NULL;
|
||||
if (kwds != NULL && PyDict_GET_SIZE(kwds) != 0) {
|
||||
if (PyErr_Warn(PyExc_DeprecationWarning,
|
||||
"Using 'x' as a keyword argument is deprecated; "
|
||||
"specify the value as a positional argument instead") < 0)
|
||||
return NULL;
|
||||
}
|
||||
/* If it's a string, but not a string subclass, use
|
||||
PyFloat_FromString. */
|
||||
if (PyUnicode_CheckExact(x))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue