From a397e56d2aad76fe5cacd54a2ecbdb03702985c7 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Thu, 9 Jun 2016 16:16:06 +0300 Subject: Issue #26305: Argument Clinic now uses braces in C code as required by PEP 7. --- Modules/clinic/sha512module.c.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Modules/clinic/sha512module.c.h') diff --git a/Modules/clinic/sha512module.c.h b/Modules/clinic/sha512module.c.h index c308739d44..94fb15ca84 100644 --- a/Modules/clinic/sha512module.c.h +++ b/Modules/clinic/sha512module.c.h @@ -103,8 +103,9 @@ _sha512_sha512(PyModuleDef *module, PyObject *args, PyObject *kwargs) PyObject *string = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:sha512", _keywords, - &string)) + &string)) { goto exit; + } return_value = _sha512_sha512_impl(module, string); exit: @@ -135,8 +136,9 @@ _sha512_sha384(PyModuleDef *module, PyObject *args, PyObject *kwargs) PyObject *string = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:sha384", _keywords, - &string)) + &string)) { goto exit; + } return_value = _sha512_sha384_impl(module, string); exit: @@ -168,4 +170,4 @@ exit: #ifndef _SHA512_SHA384_METHODDEF #define _SHA512_SHA384_METHODDEF #endif /* !defined(_SHA512_SHA384_METHODDEF) */ -/*[clinic end generated code: output=1c7d385731fee7c0 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=845af47cea22e2a1 input=a9049054013a1b77]*/ -- cgit v1.2.1 From 96d299b2b87dd2311bcc94cbab7b1cfa2c30ccba Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sun, 14 Aug 2016 10:52:18 +0300 Subject: Issue #27574: Decreased an overhead of parsing keyword arguments in functions implemented with using Argument Clinic. --- Modules/clinic/sha512module.c.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'Modules/clinic/sha512module.c.h') diff --git a/Modules/clinic/sha512module.c.h b/Modules/clinic/sha512module.c.h index ec5a0c3402..78f7743480 100644 --- a/Modules/clinic/sha512module.c.h +++ b/Modules/clinic/sha512module.c.h @@ -99,10 +99,11 @@ static PyObject * _sha512_sha512(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"string", NULL}; + static const char * const _keywords[] = {"string", NULL}; + static _PyArg_Parser _parser = {"|O:sha512", _keywords, 0}; PyObject *string = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:sha512", _keywords, + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, &string)) { goto exit; } @@ -132,10 +133,11 @@ static PyObject * _sha512_sha384(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"string", NULL}; + static const char * const _keywords[] = {"string", NULL}; + static _PyArg_Parser _parser = {"|O:sha384", _keywords, 0}; PyObject *string = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:sha384", _keywords, + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, &string)) { goto exit; } @@ -170,4 +172,4 @@ exit: #ifndef _SHA512_SHA384_METHODDEF #define _SHA512_SHA384_METHODDEF #endif /* !defined(_SHA512_SHA384_METHODDEF) */ -/*[clinic end generated code: output=e314c0f773abd5d7 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=cf0da76cb603d1bf input=a9049054013a1b77]*/ -- cgit v1.2.1 From b799c960150c910abd8e633001f14079a6360a7e Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Thu, 8 Sep 2016 09:29:11 -0700 Subject: clinic: PY_LONG_LONG -> long long --- Modules/clinic/sha512module.c.h | 50 +---------------------------------------- 1 file changed, 1 insertion(+), 49 deletions(-) (limited to 'Modules/clinic/sha512module.c.h') diff --git a/Modules/clinic/sha512module.c.h b/Modules/clinic/sha512module.c.h index 78f7743480..9680ea228a 100644 --- a/Modules/clinic/sha512module.c.h +++ b/Modules/clinic/sha512module.c.h @@ -2,8 +2,6 @@ preserve [clinic start generated code]*/ -#if defined(PY_LONG_LONG) - PyDoc_STRVAR(SHA512Type_copy__doc__, "copy($self, /)\n" "--\n" @@ -22,10 +20,6 @@ SHA512Type_copy(SHAobject *self, PyObject *Py_UNUSED(ignored)) return SHA512Type_copy_impl(self); } -#endif /* defined(PY_LONG_LONG) */ - -#if defined(PY_LONG_LONG) - PyDoc_STRVAR(SHA512Type_digest__doc__, "digest($self, /)\n" "--\n" @@ -44,10 +38,6 @@ SHA512Type_digest(SHAobject *self, PyObject *Py_UNUSED(ignored)) return SHA512Type_digest_impl(self); } -#endif /* defined(PY_LONG_LONG) */ - -#if defined(PY_LONG_LONG) - PyDoc_STRVAR(SHA512Type_hexdigest__doc__, "hexdigest($self, /)\n" "--\n" @@ -66,10 +56,6 @@ SHA512Type_hexdigest(SHAobject *self, PyObject *Py_UNUSED(ignored)) return SHA512Type_hexdigest_impl(self); } -#endif /* defined(PY_LONG_LONG) */ - -#if defined(PY_LONG_LONG) - PyDoc_STRVAR(SHA512Type_update__doc__, "update($self, obj, /)\n" "--\n" @@ -79,10 +65,6 @@ PyDoc_STRVAR(SHA512Type_update__doc__, #define SHA512TYPE_UPDATE_METHODDEF \ {"update", (PyCFunction)SHA512Type_update, METH_O, SHA512Type_update__doc__}, -#endif /* defined(PY_LONG_LONG) */ - -#if defined(PY_LONG_LONG) - PyDoc_STRVAR(_sha512_sha512__doc__, "sha512($module, /, string=b\'\')\n" "--\n" @@ -113,10 +95,6 @@ exit: return return_value; } -#endif /* defined(PY_LONG_LONG) */ - -#if defined(PY_LONG_LONG) - PyDoc_STRVAR(_sha512_sha384__doc__, "sha384($module, /, string=b\'\')\n" "--\n" @@ -146,30 +124,4 @@ _sha512_sha384(PyObject *module, PyObject *args, PyObject *kwargs) exit: return return_value; } - -#endif /* defined(PY_LONG_LONG) */ - -#ifndef SHA512TYPE_COPY_METHODDEF - #define SHA512TYPE_COPY_METHODDEF -#endif /* !defined(SHA512TYPE_COPY_METHODDEF) */ - -#ifndef SHA512TYPE_DIGEST_METHODDEF - #define SHA512TYPE_DIGEST_METHODDEF -#endif /* !defined(SHA512TYPE_DIGEST_METHODDEF) */ - -#ifndef SHA512TYPE_HEXDIGEST_METHODDEF - #define SHA512TYPE_HEXDIGEST_METHODDEF -#endif /* !defined(SHA512TYPE_HEXDIGEST_METHODDEF) */ - -#ifndef SHA512TYPE_UPDATE_METHODDEF - #define SHA512TYPE_UPDATE_METHODDEF -#endif /* !defined(SHA512TYPE_UPDATE_METHODDEF) */ - -#ifndef _SHA512_SHA512_METHODDEF - #define _SHA512_SHA512_METHODDEF -#endif /* !defined(_SHA512_SHA512_METHODDEF) */ - -#ifndef _SHA512_SHA384_METHODDEF - #define _SHA512_SHA384_METHODDEF -#endif /* !defined(_SHA512_SHA384_METHODDEF) */ -/*[clinic end generated code: output=cf0da76cb603d1bf input=a9049054013a1b77]*/ +/*[clinic end generated code: output=8f7f6603a9c4e910 input=a9049054013a1b77]*/ -- cgit v1.2.1 From daa2ed44798ad45ac665321cae21a23661d0e044 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 9 Sep 2016 20:00:13 -0700 Subject: Issue #27810: Rerun Argument Clinic on all modules --- Modules/clinic/sha512module.c.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Modules/clinic/sha512module.c.h') diff --git a/Modules/clinic/sha512module.c.h b/Modules/clinic/sha512module.c.h index 9680ea228a..a2b57f71b5 100644 --- a/Modules/clinic/sha512module.c.h +++ b/Modules/clinic/sha512module.c.h @@ -72,20 +72,20 @@ PyDoc_STRVAR(_sha512_sha512__doc__, "Return a new SHA-512 hash object; optionally initialized with a string."); #define _SHA512_SHA512_METHODDEF \ - {"sha512", (PyCFunction)_sha512_sha512, METH_VARARGS|METH_KEYWORDS, _sha512_sha512__doc__}, + {"sha512", (PyCFunction)_sha512_sha512, METH_FASTCALL, _sha512_sha512__doc__}, static PyObject * _sha512_sha512_impl(PyObject *module, PyObject *string); static PyObject * -_sha512_sha512(PyObject *module, PyObject *args, PyObject *kwargs) +_sha512_sha512(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; static const char * const _keywords[] = {"string", NULL}; static _PyArg_Parser _parser = {"|O:sha512", _keywords, 0}; PyObject *string = NULL; - if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, &string)) { goto exit; } @@ -102,20 +102,20 @@ PyDoc_STRVAR(_sha512_sha384__doc__, "Return a new SHA-384 hash object; optionally initialized with a string."); #define _SHA512_SHA384_METHODDEF \ - {"sha384", (PyCFunction)_sha512_sha384, METH_VARARGS|METH_KEYWORDS, _sha512_sha384__doc__}, + {"sha384", (PyCFunction)_sha512_sha384, METH_FASTCALL, _sha512_sha384__doc__}, static PyObject * _sha512_sha384_impl(PyObject *module, PyObject *string); static PyObject * -_sha512_sha384(PyObject *module, PyObject *args, PyObject *kwargs) +_sha512_sha384(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; static const char * const _keywords[] = {"string", NULL}; static _PyArg_Parser _parser = {"|O:sha384", _keywords, 0}; PyObject *string = NULL; - if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, &string)) { goto exit; } @@ -124,4 +124,4 @@ _sha512_sha384(PyObject *module, PyObject *args, PyObject *kwargs) exit: return return_value; } -/*[clinic end generated code: output=8f7f6603a9c4e910 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=18f15598c3487045 input=a9049054013a1b77]*/ -- cgit v1.2.1