summaryrefslogtreecommitdiffstats
path: root/Modules/clinic/_ssl.c.h
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/clinic/_ssl.c.h')
-rw-r--r--Modules/clinic/_ssl.c.h248
1 files changed, 220 insertions, 28 deletions
diff --git a/Modules/clinic/_ssl.c.h b/Modules/clinic/_ssl.c.h
index 3ec30c3..b1012f7 100644
--- a/Modules/clinic/_ssl.c.h
+++ b/Modules/clinic/_ssl.c.h
@@ -340,13 +340,32 @@ _ssl__SSLSocket_get_channel_binding(PySSLSocket *self, PyObject *const *args, Py
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"cb_type", NULL};
- static _PyArg_Parser _parser = {"|s:get_channel_binding", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "get_channel_binding", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
const char *cb_type = "tls-unique";
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &cb_type)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (!PyUnicode_Check(args[0])) {
+ _PyArg_BadArgument("get_channel_binding", 1, "str", args[0]);
+ goto exit;
+ }
+ Py_ssize_t cb_type_length;
+ cb_type = PyUnicode_AsUTF8AndSize(args[0], &cb_type_length);
+ if (cb_type == NULL) {
+ goto exit;
+ }
+ if (strlen(cb_type) != (size_t)cb_type_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
+ goto exit;
+ }
+skip_optional_pos:
return_value = _ssl__SSLSocket_get_channel_binding_impl(self, cb_type);
exit:
@@ -548,15 +567,29 @@ _ssl__SSLContext_load_cert_chain(PySSLContext *self, PyObject *const *args, Py_s
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"certfile", "keyfile", "password", NULL};
- static _PyArg_Parser _parser = {"O|OO:load_cert_chain", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "load_cert_chain", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *certfile;
PyObject *keyfile = NULL;
PyObject *password = NULL;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &certfile, &keyfile, &password)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ certfile = args[0];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[1]) {
+ keyfile = args[1];
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ password = args[2];
+skip_optional_pos:
return_value = _ssl__SSLContext_load_cert_chain_impl(self, certfile, keyfile, password);
exit:
@@ -582,15 +615,34 @@ _ssl__SSLContext_load_verify_locations(PySSLContext *self, PyObject *const *args
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"cafile", "capath", "cadata", NULL};
- static _PyArg_Parser _parser = {"|OOO:load_verify_locations", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "load_verify_locations", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *cafile = NULL;
PyObject *capath = NULL;
PyObject *cadata = NULL;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &cafile, &capath, &cadata)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 3, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[0]) {
+ cafile = args[0];
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ if (args[1]) {
+ capath = args[1];
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ cadata = args[2];
+skip_optional_pos:
return_value = _ssl__SSLContext_load_verify_locations_impl(self, cafile, capath, cadata);
exit:
@@ -624,17 +676,54 @@ _ssl__SSLContext__wrap_socket(PySSLContext *self, PyObject *const *args, Py_ssiz
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"sock", "server_side", "server_hostname", "owner", "session", NULL};
- static _PyArg_Parser _parser = {"O!i|O$OO:_wrap_socket", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "_wrap_socket", 0};
+ PyObject *argsbuf[5];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
PyObject *sock;
int server_side;
PyObject *hostname_obj = Py_None;
PyObject *owner = Py_None;
PyObject *session = Py_None;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- PySocketModule.Sock_Type, &sock, &server_side, &hostname_obj, &owner, &session)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!PyObject_TypeCheck(args[0], PySocketModule.Sock_Type)) {
+ _PyArg_BadArgument("_wrap_socket", 1, (PySocketModule.Sock_Type)->tp_name, args[0]);
goto exit;
}
+ sock = args[0];
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ server_side = _PyLong_AsInt(args[1]);
+ if (server_side == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[2]) {
+ hostname_obj = args[2];
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+skip_optional_pos:
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (args[3]) {
+ owner = args[3];
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ session = args[4];
+skip_optional_kwonly:
return_value = _ssl__SSLContext__wrap_socket_impl(self, sock, server_side, hostname_obj, owner, session);
exit:
@@ -661,7 +750,9 @@ _ssl__SSLContext__wrap_bio(PySSLContext *self, PyObject *const *args, Py_ssize_t
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"incoming", "outgoing", "server_side", "server_hostname", "owner", "session", NULL};
- static _PyArg_Parser _parser = {"O!O!i|O$OO:_wrap_bio", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "_wrap_bio", 0};
+ PyObject *argsbuf[6];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 3;
PySSLMemoryBIO *incoming;
PySSLMemoryBIO *outgoing;
int server_side;
@@ -669,10 +760,50 @@ _ssl__SSLContext__wrap_bio(PySSLContext *self, PyObject *const *args, Py_ssize_t
PyObject *owner = Py_None;
PyObject *session = Py_None;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &PySSLMemoryBIO_Type, &incoming, &PySSLMemoryBIO_Type, &outgoing, &server_side, &hostname_obj, &owner, &session)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 4, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!PyObject_TypeCheck(args[0], &PySSLMemoryBIO_Type)) {
+ _PyArg_BadArgument("_wrap_bio", 1, (&PySSLMemoryBIO_Type)->tp_name, args[0]);
+ goto exit;
+ }
+ incoming = (PySSLMemoryBIO *)args[0];
+ if (!PyObject_TypeCheck(args[1], &PySSLMemoryBIO_Type)) {
+ _PyArg_BadArgument("_wrap_bio", 2, (&PySSLMemoryBIO_Type)->tp_name, args[1]);
+ goto exit;
+ }
+ outgoing = (PySSLMemoryBIO *)args[1];
+ if (PyFloat_Check(args[2])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ server_side = _PyLong_AsInt(args[2]);
+ if (server_side == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[3]) {
+ hostname_obj = args[3];
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+skip_optional_pos:
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (args[4]) {
+ owner = args[4];
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ session = args[5];
+skip_optional_kwonly:
return_value = _ssl__SSLContext__wrap_bio_impl(self, incoming, outgoing, server_side, hostname_obj, owner, session);
exit:
@@ -772,13 +903,23 @@ _ssl__SSLContext_get_ca_certs(PySSLContext *self, PyObject *const *args, Py_ssiz
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"binary_form", NULL};
- static _PyArg_Parser _parser = {"|p:get_ca_certs", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "get_ca_certs", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
int binary_form = 0;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &binary_form)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ binary_form = PyObject_IsTrue(args[0]);
+ if (binary_form < 0) {
+ goto exit;
+ }
+skip_optional_pos:
return_value = _ssl__SSLContext_get_ca_certs_impl(self, binary_form);
exit:
@@ -1131,14 +1272,37 @@ _ssl_txt2obj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"txt", "name", NULL};
- static _PyArg_Parser _parser = {"s|p:txt2obj", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "txt2obj", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
const char *txt;
int name = 0;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &txt, &name)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!PyUnicode_Check(args[0])) {
+ _PyArg_BadArgument("txt2obj", 1, "str", args[0]);
+ goto exit;
+ }
+ Py_ssize_t txt_length;
+ txt = PyUnicode_AsUTF8AndSize(args[0], &txt_length);
+ if (txt == NULL) {
+ goto exit;
+ }
+ if (strlen(txt) != (size_t)txt_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ name = PyObject_IsTrue(args[1]);
+ if (name < 0) {
+ goto exit;
+ }
+skip_optional_pos:
return_value = _ssl_txt2obj_impl(module, txt, name);
exit:
@@ -1203,11 +1367,25 @@ _ssl_enum_certificates(PyObject *module, PyObject *const *args, Py_ssize_t nargs
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"store_name", NULL};
- static _PyArg_Parser _parser = {"s:enum_certificates", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "enum_certificates", 0};
+ PyObject *argsbuf[1];
const char *store_name;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &store_name)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!PyUnicode_Check(args[0])) {
+ _PyArg_BadArgument("enum_certificates", 1, "str", args[0]);
+ goto exit;
+ }
+ Py_ssize_t store_name_length;
+ store_name = PyUnicode_AsUTF8AndSize(args[0], &store_name_length);
+ if (store_name == NULL) {
+ goto exit;
+ }
+ if (strlen(store_name) != (size_t)store_name_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _ssl_enum_certificates_impl(module, store_name);
@@ -1242,11 +1420,25 @@ _ssl_enum_crls(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"store_name", NULL};
- static _PyArg_Parser _parser = {"s:enum_crls", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "enum_crls", 0};
+ PyObject *argsbuf[1];
const char *store_name;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &store_name)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!PyUnicode_Check(args[0])) {
+ _PyArg_BadArgument("enum_crls", 1, "str", args[0]);
+ goto exit;
+ }
+ Py_ssize_t store_name_length;
+ store_name = PyUnicode_AsUTF8AndSize(args[0], &store_name_length);
+ if (store_name == NULL) {
+ goto exit;
+ }
+ if (strlen(store_name) != (size_t)store_name_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _ssl_enum_crls_impl(module, store_name);
@@ -1284,4 +1476,4 @@ exit:
#ifndef _SSL_ENUM_CRLS_METHODDEF
#define _SSL_ENUM_CRLS_METHODDEF
#endif /* !defined(_SSL_ENUM_CRLS_METHODDEF) */
-/*[clinic end generated code: output=ac3fb15ca27500f2 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=a399d0eb393b6fab input=a9049054013a1b77]*/