diff options
| author | Sylvain <sylvain.desodt+github@gmail.com> | 2017-06-10 04:51:48 (GMT) |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-06-10 04:51:48 (GMT) |
| commit | 7445381c606faf20e253da42656db478a4349f8e (patch) | |
| tree | 49ad79e5347454d1bbfeb1c2d06d3d09fd9b273f /Python/clinic/marshal.c.h | |
| parent | e5f6e86c48c7b2eb9e1d6a0e72867b4d8b4720f3 (diff) | |
| download | cpython-7445381c606faf20e253da42656db478a4349f8e.zip cpython-7445381c606faf20e253da42656db478a4349f8e.tar.gz cpython-7445381c606faf20e253da42656db478a4349f8e.tar.bz2 | |
bpo-30600: Fix error messages (condition order in Argument Clinic) (#2051)
The function '_PyArg_ParseStack()' and
'_PyArg_UnpackStack' were failing (with error
"XXX() takes Y argument (Z given)") before
the function '_PyArg_NoStackKeywords()' was called.
Thus, the latter did not raise its more meaningful
error : "XXX() takes no keyword arguments".
Diffstat (limited to 'Python/clinic/marshal.c.h')
| -rw-r--r-- | Python/clinic/marshal.c.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Python/clinic/marshal.c.h b/Python/clinic/marshal.c.h index ae2c899..64504ba 100644 --- a/Python/clinic/marshal.c.h +++ b/Python/clinic/marshal.c.h @@ -34,12 +34,12 @@ marshal_dump(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna PyObject *file; int version = Py_MARSHAL_VERSION; - if (!_PyArg_ParseStack(args, nargs, "OO|i:dump", - &value, &file, &version)) { + if (!_PyArg_NoStackKeywords("dump", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("dump", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "OO|i:dump", + &value, &file, &version)) { goto exit; } return_value = marshal_dump_impl(module, value, file, version); @@ -94,12 +94,12 @@ marshal_dumps(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwn PyObject *value; int version = Py_MARSHAL_VERSION; - if (!_PyArg_ParseStack(args, nargs, "O|i:dumps", - &value, &version)) { + if (!_PyArg_NoStackKeywords("dumps", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("dumps", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "O|i:dumps", + &value, &version)) { goto exit; } return_value = marshal_dumps_impl(module, value, version); @@ -142,4 +142,4 @@ exit: return return_value; } -/*[clinic end generated code: output=9dec2158b8c5d975 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=7b147a648614af7e input=a9049054013a1b77]*/ |
