summaryrefslogtreecommitdiffstats
path: root/Modules/clinic
diff options
context:
space:
mode:
authorMohamed Koubaa <koubaa.m@gmail.com>2020-09-06 10:09:51 (GMT)
committerGitHub <noreply@github.com>2020-09-06 10:09:51 (GMT)
commit63f102fe079ecb5cb7b921a1cf8bce4077a9d7e2 (patch)
tree55496c20a4e8da0303a51474ff3b559108683e9f /Modules/clinic
parent5371a464ce88ffc88f3bb95cfd86f355b7d02953 (diff)
downloadcpython-63f102fe079ecb5cb7b921a1cf8bce4077a9d7e2.zip
cpython-63f102fe079ecb5cb7b921a1cf8bce4077a9d7e2.tar.gz
cpython-63f102fe079ecb5cb7b921a1cf8bce4077a9d7e2.tar.bz2
bpo-1635741: Port _sha1, _sha512, _md5 to multiphase init (GH-21818)
Port the _sha1, _sha512, and _md5 extension modules to multi-phase initialization API (PEP 489).
Diffstat (limited to 'Modules/clinic')
-rw-r--r--Modules/clinic/md5module.c.h21
-rw-r--r--Modules/clinic/sha1module.c.h21
-rw-r--r--Modules/clinic/sha512module.c.h21
3 files changed, 48 insertions, 15 deletions
diff --git a/Modules/clinic/md5module.c.h b/Modules/clinic/md5module.c.h
index c109f9e..4762f28 100644
--- a/Modules/clinic/md5module.c.h
+++ b/Modules/clinic/md5module.c.h
@@ -9,15 +9,26 @@ PyDoc_STRVAR(MD5Type_copy__doc__,
"Return a copy of the hash object.");
#define MD5TYPE_COPY_METHODDEF \
- {"copy", (PyCFunction)MD5Type_copy, METH_NOARGS, MD5Type_copy__doc__},
+ {"copy", (PyCFunction)(void(*)(void))MD5Type_copy, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, MD5Type_copy__doc__},
static PyObject *
-MD5Type_copy_impl(MD5object *self);
+MD5Type_copy_impl(MD5object *self, PyTypeObject *cls);
static PyObject *
-MD5Type_copy(MD5object *self, PyObject *Py_UNUSED(ignored))
+MD5Type_copy(MD5object *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
- return MD5Type_copy_impl(self);
+ PyObject *return_value = NULL;
+ static const char * const _keywords[] = { NULL};
+ static _PyArg_Parser _parser = {":copy", _keywords, 0};
+
+ if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
+ )) {
+ goto exit;
+ }
+ return_value = MD5Type_copy_impl(self, cls);
+
+exit:
+ return return_value;
}
PyDoc_STRVAR(MD5Type_digest__doc__,
@@ -115,4 +126,4 @@ skip_optional_kwonly:
exit:
return return_value;
}
-/*[clinic end generated code: output=dbe3abc60086f3ef input=a9049054013a1b77]*/
+/*[clinic end generated code: output=53ff7f22dbaaea36 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/sha1module.c.h b/Modules/clinic/sha1module.c.h
index fc37b1a..3a3ab58 100644
--- a/Modules/clinic/sha1module.c.h
+++ b/Modules/clinic/sha1module.c.h
@@ -9,15 +9,26 @@ PyDoc_STRVAR(SHA1Type_copy__doc__,
"Return a copy of the hash object.");
#define SHA1TYPE_COPY_METHODDEF \
- {"copy", (PyCFunction)SHA1Type_copy, METH_NOARGS, SHA1Type_copy__doc__},
+ {"copy", (PyCFunction)(void(*)(void))SHA1Type_copy, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, SHA1Type_copy__doc__},
static PyObject *
-SHA1Type_copy_impl(SHA1object *self);
+SHA1Type_copy_impl(SHA1object *self, PyTypeObject *cls);
static PyObject *
-SHA1Type_copy(SHA1object *self, PyObject *Py_UNUSED(ignored))
+SHA1Type_copy(SHA1object *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
- return SHA1Type_copy_impl(self);
+ PyObject *return_value = NULL;
+ static const char * const _keywords[] = { NULL};
+ static _PyArg_Parser _parser = {":copy", _keywords, 0};
+
+ if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
+ )) {
+ goto exit;
+ }
+ return_value = SHA1Type_copy_impl(self, cls);
+
+exit:
+ return return_value;
}
PyDoc_STRVAR(SHA1Type_digest__doc__,
@@ -115,4 +126,4 @@ skip_optional_kwonly:
exit:
return return_value;
}
-/*[clinic end generated code: output=3ddd637ae17e14b3 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=abf1ab2545cea5a2 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/sha512module.c.h b/Modules/clinic/sha512module.c.h
index b8185b6..f1192d7 100644
--- a/Modules/clinic/sha512module.c.h
+++ b/Modules/clinic/sha512module.c.h
@@ -9,15 +9,26 @@ PyDoc_STRVAR(SHA512Type_copy__doc__,
"Return a copy of the hash object.");
#define SHA512TYPE_COPY_METHODDEF \
- {"copy", (PyCFunction)SHA512Type_copy, METH_NOARGS, SHA512Type_copy__doc__},
+ {"copy", (PyCFunction)(void(*)(void))SHA512Type_copy, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, SHA512Type_copy__doc__},
static PyObject *
-SHA512Type_copy_impl(SHAobject *self);
+SHA512Type_copy_impl(SHAobject *self, PyTypeObject *cls);
static PyObject *
-SHA512Type_copy(SHAobject *self, PyObject *Py_UNUSED(ignored))
+SHA512Type_copy(SHAobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
- return SHA512Type_copy_impl(self);
+ PyObject *return_value = NULL;
+ static const char * const _keywords[] = { NULL};
+ static _PyArg_Parser _parser = {":copy", _keywords, 0};
+
+ if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
+ )) {
+ goto exit;
+ }
+ return_value = SHA512Type_copy_impl(self, cls);
+
+exit:
+ return return_value;
}
PyDoc_STRVAR(SHA512Type_digest__doc__,
@@ -166,4 +177,4 @@ skip_optional_kwonly:
exit:
return return_value;
}
-/*[clinic end generated code: output=bbfa72d8703c82b5 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=9ff9f11937fabf35 input=a9049054013a1b77]*/