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:
Serhiy Storchaka 2019-09-14 12:24:05 +03:00 committed by GitHub
parent d057b896f9
commit 279f44678c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
47 changed files with 256 additions and 257 deletions

View file

@ -1042,7 +1042,7 @@ double_round(double x, int ndigits) {
/*[clinic input]
float.__round__
ndigits as o_ndigits: object = NULL
ndigits as o_ndigits: object = None
/
Return the Integral closest to x, rounding half toward even.
@ -1052,13 +1052,13 @@ When an argument is passed, work like built-in round(x, ndigits).
static PyObject *
float___round___impl(PyObject *self, PyObject *o_ndigits)
/*[clinic end generated code: output=374c36aaa0f13980 input=1ca2316b510293b8]*/
/*[clinic end generated code: output=374c36aaa0f13980 input=fc0fe25924fbc9ed]*/
{
double x, rounded;
Py_ssize_t ndigits;
x = PyFloat_AsDouble(self);
if (o_ndigits == NULL || o_ndigits == Py_None) {
if (o_ndigits == Py_None) {
/* single-argument round or with None ndigits:
* round to nearest integer */
rounded = round(x);