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

@ -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]*/

View file

@ -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]*/

View file

@ -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]*/

View file

@ -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;
@ -995,4 +995,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=8b250245a1265eef input=a9049054013a1b77]*/
/*[clinic end generated code: output=decd687b7631de4b input=a9049054013a1b77]*/