mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
bpo-37206: Unrepresentable default values no longer represented as None. (GH-13933)
In ArgumentClinic, value "NULL" should now be used only for unrepresentable default values (like in the optional third parameter of getattr). "None" should be used if None is accepted as argument and passing None has the same effect as not passing the argument at all.
This commit is contained in:
parent
d057b896f9
commit
279f44678c
47 changed files with 256 additions and 257 deletions
|
@ -2140,7 +2140,7 @@ builtin_repr(PyObject *module, PyObject *obj)
|
|||
round as builtin_round
|
||||
|
||||
number: object
|
||||
ndigits: object = NULL
|
||||
ndigits: object = None
|
||||
|
||||
Round a number to a given precision in decimal digits.
|
||||
|
||||
|
@ -2150,7 +2150,7 @@ the return value has the same type as the number. ndigits may be negative.
|
|||
|
||||
static PyObject *
|
||||
builtin_round_impl(PyObject *module, PyObject *number, PyObject *ndigits)
|
||||
/*[clinic end generated code: output=ff0d9dd176c02ede input=854bc3a217530c3d]*/
|
||||
/*[clinic end generated code: output=ff0d9dd176c02ede input=275678471d7aca15]*/
|
||||
{
|
||||
PyObject *round, *result;
|
||||
|
||||
|
@ -2168,7 +2168,7 @@ builtin_round_impl(PyObject *module, PyObject *number, PyObject *ndigits)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (ndigits == NULL || ndigits == Py_None)
|
||||
if (ndigits == Py_None)
|
||||
result = _PyObject_CallNoArg(round);
|
||||
else
|
||||
result = _PyObject_CallOneArg(round, ndigits);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue