diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2019-09-14 10:31:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-14 10:31:50 (GMT) |
commit | d322abbb83eb751045246a70f39d040d13a6108b (patch) | |
tree | 40ecc91950b369af1aaaebdd677c071aeae72d53 /Python | |
parent | 66da347ef0034ad9bddc7fad112025c886249f0d (diff) | |
download | cpython-d322abbb83eb751045246a70f39d040d13a6108b.zip cpython-d322abbb83eb751045246a70f39d040d13a6108b.tar.gz cpython-d322abbb83eb751045246a70f39d040d13a6108b.tar.bz2 |
[3.8] bpo-37206: Unrepresentable default values no longer represented as None. (GH-13933) (GH-16141)
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.
(cherry picked from commit 279f44678c8b84a183f9eeb85e0b086228154497)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Python')
-rw-r--r-- | Python/bltinmodule.c | 6 | ||||
-rw-r--r-- | Python/clinic/bltinmodule.c.h | 4 | ||||
-rw-r--r-- | Python/clinic/context.c.h | 4 | ||||
-rw-r--r-- | Python/clinic/import.c.h | 4 | ||||
-rw-r--r-- | Python/clinic/sysmodule.c.h | 4 | ||||
-rw-r--r-- | Python/sysmodule.c | 4 |
6 files changed, 13 insertions, 13 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 8f9e813..c8d34c9 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -2147,7 +2147,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. @@ -2157,7 +2157,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; @@ -2175,7 +2175,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_CallFunctionObjArgs(round, ndigits, NULL); diff --git a/Python/clinic/bltinmodule.c.h b/Python/clinic/bltinmodule.c.h index 49608cc..b936b0c 100644 --- a/Python/clinic/bltinmodule.c.h +++ b/Python/clinic/bltinmodule.c.h @@ -719,7 +719,7 @@ builtin_round(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec PyObject *argsbuf[2]; Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; PyObject *number; - PyObject *ndigits = NULL; + PyObject *ndigits = Py_None; args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf); if (!args) { @@ -849,4 +849,4 @@ builtin_issubclass(PyObject *module, PyObject *const *args, Py_ssize_t nargs) exit: return return_value; } -/*[clinic end generated code: output=1927f3c9abd00c35 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=4e118c2cd2cd98f3 input=a9049054013a1b77]*/ diff --git a/Python/clinic/context.c.h b/Python/clinic/context.c.h index eedfc88..2ac8bf7 100644 --- a/Python/clinic/context.c.h +++ b/Python/clinic/context.c.h @@ -115,7 +115,7 @@ _contextvars_Context_copy(PyContext *self, PyObject *Py_UNUSED(ignored)) } PyDoc_STRVAR(_contextvars_ContextVar_get__doc__, -"get($self, default=None, /)\n" +"get($self, default=<unrepresentable>, /)\n" "--\n" "\n" "Return a value for the context variable for the current context.\n" @@ -177,4 +177,4 @@ PyDoc_STRVAR(_contextvars_ContextVar_reset__doc__, #define _CONTEXTVARS_CONTEXTVAR_RESET_METHODDEF \ {"reset", (PyCFunction)_contextvars_ContextVar_reset, METH_O, _contextvars_ContextVar_reset__doc__}, -/*[clinic end generated code: output=a86b66e1516c25d4 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=f2e42f34e358e179 input=a9049054013a1b77]*/ diff --git a/Python/clinic/import.c.h b/Python/clinic/import.c.h index 743d002..e4867f3 100644 --- a/Python/clinic/import.c.h +++ b/Python/clinic/import.c.h @@ -300,7 +300,7 @@ exit: #if defined(HAVE_DYNAMIC_LOADING) PyDoc_STRVAR(_imp_create_dynamic__doc__, -"create_dynamic($module, spec, file=None, /)\n" +"create_dynamic($module, spec, file=<unrepresentable>, /)\n" "--\n" "\n" "Create an extension module."); @@ -454,4 +454,4 @@ exit: #ifndef _IMP_EXEC_DYNAMIC_METHODDEF #define _IMP_EXEC_DYNAMIC_METHODDEF #endif /* !defined(_IMP_EXEC_DYNAMIC_METHODDEF) */ -/*[clinic end generated code: output=ff06f7cf4b73eb76 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=3dc495e9c64d944e input=a9049054013a1b77]*/ diff --git a/Python/clinic/sysmodule.c.h b/Python/clinic/sysmodule.c.h index 93bc332..d2d1503 100644 --- a/Python/clinic/sysmodule.c.h +++ b/Python/clinic/sysmodule.c.h @@ -135,7 +135,7 @@ static PyObject * sys_exit(PyObject *module, PyObject *const *args, Py_ssize_t nargs) { PyObject *return_value = NULL; - PyObject *status = NULL; + PyObject *status = Py_None; if (!_PyArg_CheckPositional("exit", nargs, 0, 1)) { goto exit; @@ -1088,4 +1088,4 @@ sys_getandroidapilevel(PyObject *module, PyObject *Py_UNUSED(ignored)) #ifndef SYS_GETANDROIDAPILEVEL_METHODDEF #define SYS_GETANDROIDAPILEVEL_METHODDEF #endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */ -/*[clinic end generated code: output=092edc868de055a6 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=273f9cec8bfcab91 input=a9049054013a1b77]*/ diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 57f7a9a..5175158 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -705,7 +705,7 @@ sys_unraisablehook(PyObject *module, PyObject *unraisable) /*[clinic input] sys.exit - status: object = NULL + status: object = None / Exit the interpreter by raising SystemExit(status). @@ -718,7 +718,7 @@ exit status will be one (i.e., failure). static PyObject * sys_exit_impl(PyObject *module, PyObject *status) -/*[clinic end generated code: output=13870986c1ab2ec0 input=a737351f86685e9c]*/ +/*[clinic end generated code: output=13870986c1ab2ec0 input=b86ca9497baa94f2]*/ { /* Raise SystemExit so callers may catch it or clean up. */ PyErr_SetObject(PyExc_SystemExit, status); |