Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
allendowney
GitHub Repository: allendowney/cpython
Path: blob/main/Modules/_ssl/clinic/cert.c.h
12 views
1
/*[clinic input]
2
preserve
3
[clinic start generated code]*/
4
5
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
6
# include "pycore_gc.h" // PyGC_Head
7
# include "pycore_runtime.h" // _Py_ID()
8
#endif
9
10
11
PyDoc_STRVAR(_ssl_Certificate_public_bytes__doc__,
12
"public_bytes($self, /, format=Encoding.PEM)\n"
13
"--\n"
14
"\n");
15
16
#define _SSL_CERTIFICATE_PUBLIC_BYTES_METHODDEF \
17
{"public_bytes", _PyCFunction_CAST(_ssl_Certificate_public_bytes), METH_FASTCALL|METH_KEYWORDS, _ssl_Certificate_public_bytes__doc__},
18
19
static PyObject *
20
_ssl_Certificate_public_bytes_impl(PySSLCertificate *self, int format);
21
22
static PyObject *
23
_ssl_Certificate_public_bytes(PySSLCertificate *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
24
{
25
PyObject *return_value = NULL;
26
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
27
28
#define NUM_KEYWORDS 1
29
static struct {
30
PyGC_Head _this_is_not_used;
31
PyObject_VAR_HEAD
32
PyObject *ob_item[NUM_KEYWORDS];
33
} _kwtuple = {
34
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
35
.ob_item = { &_Py_ID(format), },
36
};
37
#undef NUM_KEYWORDS
38
#define KWTUPLE (&_kwtuple.ob_base.ob_base)
39
40
#else // !Py_BUILD_CORE
41
# define KWTUPLE NULL
42
#endif // !Py_BUILD_CORE
43
44
static const char * const _keywords[] = {"format", NULL};
45
static _PyArg_Parser _parser = {
46
.keywords = _keywords,
47
.fname = "public_bytes",
48
.kwtuple = KWTUPLE,
49
};
50
#undef KWTUPLE
51
PyObject *argsbuf[1];
52
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
53
int format = PY_SSL_ENCODING_PEM;
54
55
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
56
if (!args) {
57
goto exit;
58
}
59
if (!noptargs) {
60
goto skip_optional_pos;
61
}
62
format = _PyLong_AsInt(args[0]);
63
if (format == -1 && PyErr_Occurred()) {
64
goto exit;
65
}
66
skip_optional_pos:
67
return_value = _ssl_Certificate_public_bytes_impl(self, format);
68
69
exit:
70
return return_value;
71
}
72
73
PyDoc_STRVAR(_ssl_Certificate_get_info__doc__,
74
"get_info($self, /)\n"
75
"--\n"
76
"\n");
77
78
#define _SSL_CERTIFICATE_GET_INFO_METHODDEF \
79
{"get_info", (PyCFunction)_ssl_Certificate_get_info, METH_NOARGS, _ssl_Certificate_get_info__doc__},
80
81
static PyObject *
82
_ssl_Certificate_get_info_impl(PySSLCertificate *self);
83
84
static PyObject *
85
_ssl_Certificate_get_info(PySSLCertificate *self, PyObject *Py_UNUSED(ignored))
86
{
87
return _ssl_Certificate_get_info_impl(self);
88
}
89
/*[clinic end generated code: output=82efada014f9b7fe input=a9049054013a1b77]*/
90
91