mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +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
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue