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 /Modules/clinic/_ssl.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 'Modules/clinic/_ssl.c.h')
-rw-r--r-- | Modules/clinic/_ssl.c.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Modules/clinic/_ssl.c.h b/Modules/clinic/_ssl.c.h index 4a053d4..ece3088 100644 --- a/Modules/clinic/_ssl.c.h +++ b/Modules/clinic/_ssl.c.h @@ -71,12 +71,12 @@ _ssl__SSLSocket_peer_certificate(PySSLSocket *self, PyObject **args, Py_ssize_t PyObject *return_value = NULL; int binary_mode = 0; - if (!_PyArg_ParseStack(args, nargs, "|p:peer_certificate", - &binary_mode)) { + if (!_PyArg_NoStackKeywords("peer_certificate", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("peer_certificate", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "|p:peer_certificate", + &binary_mode)) { goto exit; } return_value = _ssl__SSLSocket_peer_certificate_impl(self, binary_mode); @@ -772,12 +772,12 @@ _ssl_MemoryBIO_read(PySSLMemoryBIO *self, PyObject **args, Py_ssize_t nargs, PyO PyObject *return_value = NULL; int len = -1; - if (!_PyArg_ParseStack(args, nargs, "|i:read", - &len)) { + if (!_PyArg_NoStackKeywords("read", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("read", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "|i:read", + &len)) { goto exit; } return_value = _ssl_MemoryBIO_read_impl(self, len); @@ -862,12 +862,12 @@ _ssl_RAND_add(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwn Py_buffer view = {NULL, NULL}; double entropy; - if (!_PyArg_ParseStack(args, nargs, "s*d:RAND_add", - &view, &entropy)) { + if (!_PyArg_NoStackKeywords("RAND_add", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("RAND_add", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "s*d:RAND_add", + &view, &entropy)) { goto exit; } return_value = _ssl_RAND_add_impl(module, &view, entropy); @@ -1180,4 +1180,4 @@ exit: #ifndef _SSL_ENUM_CRLS_METHODDEF #define _SSL_ENUM_CRLS_METHODDEF #endif /* !defined(_SSL_ENUM_CRLS_METHODDEF) */ -/*[clinic end generated code: output=53cd9100580b45a2 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=2ab0e4fdb2d2acbc input=a9049054013a1b77]*/ |