cert.c.h 2.6 KB

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