| 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 |
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords() |
| 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(PyObject *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 |
Py_hash_t ob_hash; |
| 33 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 34 |
} _kwtuple = { |
| 35 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 36 |
.ob_hash = -1, |
| 37 |
.ob_item = { &_Py_ID(format), }, |
| 38 |
}; |
| 39 |
#undef NUM_KEYWORDS |
| 40 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 41 |
|
| 42 |
#else // !Py_BUILD_CORE |
| 43 |
# define KWTUPLE NULL |
| 44 |
#endif // !Py_BUILD_CORE |
| 45 |
|
| 46 |
static const char * const _keywords[] = {"format", NULL}; |
| 47 |
static _PyArg_Parser _parser = { |
| 48 |
.keywords = _keywords, |
| 49 |
.fname = "public_bytes", |
| 50 |
.kwtuple = KWTUPLE, |
| 51 |
}; |
| 52 |
#undef KWTUPLE |
| 53 |
PyObject *argsbuf[1]; |
| 54 |
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; |
| 55 |
int format = PY_SSL_ENCODING_PEM; |
| 56 |
|
| 57 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
| 58 |
/*minpos*/ 0, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
| 59 |
if (!args) { |
| 60 |
goto exit; |
| 61 |
} |
| 62 |
if (!noptargs) { |
| 63 |
goto skip_optional_pos; |
| 64 |
} |
| 65 |
format = PyLong_AsInt(args[0]); |
| 66 |
if (format == -1 && PyErr_Occurred()) { |
| 67 |
goto exit; |
| 68 |
} |
| 69 |
skip_optional_pos: |
| 70 |
return_value = _ssl_Certificate_public_bytes_impl((PySSLCertificate *)self, format); |
| 71 |
|
| 72 |
exit: |
| 73 |
return return_value; |
| 74 |
} |
| 75 |
|
| 76 |
PyDoc_STRVAR(_ssl_Certificate_get_info__doc__, |
| 77 |
"get_info($self, /)\n" |
| 78 |
"--\n" |
| 79 |
"\n"); |
| 80 |
|
| 81 |
#define _SSL_CERTIFICATE_GET_INFO_METHODDEF \ |
| 82 |
{"get_info", (PyCFunction)_ssl_Certificate_get_info, METH_NOARGS, _ssl_Certificate_get_info__doc__}, |
| 83 |
|
| 84 |
static PyObject * |
| 85 |
_ssl_Certificate_get_info_impl(PySSLCertificate *self); |
| 86 |
|
| 87 |
static PyObject * |
| 88 |
_ssl_Certificate_get_info(PyObject *self, PyObject *Py_UNUSED(ignored)) |
| 89 |
{ |
| 90 |
return _ssl_Certificate_get_info_impl((PySSLCertificate *)self); |
| 91 |
} |
| 92 |
/*[clinic end generated code: output=bab2dba7dbc1523c input=a9049054013a1b77]*/ |