clinic: PY_LONG_LONG -> long long
This commit is contained in:
parent
c235af47f1
commit
cc854499e4
|
@ -827,9 +827,9 @@ on the right is the text you'd replace it with.
|
||||||
``'i'`` ``int``
|
``'i'`` ``int``
|
||||||
``'I'`` ``unsigned_int(bitwise=True)``
|
``'I'`` ``unsigned_int(bitwise=True)``
|
||||||
``'k'`` ``unsigned_long(bitwise=True)``
|
``'k'`` ``unsigned_long(bitwise=True)``
|
||||||
``'K'`` ``unsigned_PY_LONG_LONG(bitwise=True)``
|
``'K'`` ``unsigned_long_long(bitwise=True)``
|
||||||
``'l'`` ``long``
|
``'l'`` ``long``
|
||||||
``'L'`` ``PY_LONG_LONG``
|
``'L'`` ``long long``
|
||||||
``'n'`` ``Py_ssize_t``
|
``'n'`` ``Py_ssize_t``
|
||||||
``'O'`` ``object``
|
``'O'`` ``object``
|
||||||
``'O!'`` ``object(subclass_of='&PySomething_Type')``
|
``'O!'`` ``object(subclass_of='&PySomething_Type')``
|
||||||
|
|
|
@ -15,12 +15,14 @@ static PyObject *
|
||||||
py_sha3_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
py_sha3_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
static char *_keywords[] = {"string", NULL};
|
static const char * const _keywords[] = {"string", NULL};
|
||||||
|
static _PyArg_Parser _parser = {"|O:sha3_224", _keywords, 0};
|
||||||
PyObject *data = NULL;
|
PyObject *data = NULL;
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:sha3_224", _keywords,
|
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
|
||||||
&data))
|
&data)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
|
}
|
||||||
return_value = py_sha3_new_impl(type, data);
|
return_value = py_sha3_new_impl(type, data);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -106,12 +108,14 @@ static PyObject *
|
||||||
_sha3_shake_128_digest(SHA3object *self, PyObject *args, PyObject *kwargs)
|
_sha3_shake_128_digest(SHA3object *self, PyObject *args, PyObject *kwargs)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
static char *_keywords[] = {"length", NULL};
|
static const char * const _keywords[] = {"length", NULL};
|
||||||
|
static _PyArg_Parser _parser = {"k:digest", _keywords, 0};
|
||||||
unsigned long length;
|
unsigned long length;
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "k:digest", _keywords,
|
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
|
||||||
&length))
|
&length)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _sha3_shake_128_digest_impl(self, length);
|
return_value = _sha3_shake_128_digest_impl(self, length);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -134,15 +138,17 @@ static PyObject *
|
||||||
_sha3_shake_128_hexdigest(SHA3object *self, PyObject *args, PyObject *kwargs)
|
_sha3_shake_128_hexdigest(SHA3object *self, PyObject *args, PyObject *kwargs)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
static char *_keywords[] = {"length", NULL};
|
static const char * const _keywords[] = {"length", NULL};
|
||||||
|
static _PyArg_Parser _parser = {"k:hexdigest", _keywords, 0};
|
||||||
unsigned long length;
|
unsigned long length;
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "k:hexdigest", _keywords,
|
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
|
||||||
&length))
|
&length)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _sha3_shake_128_hexdigest_impl(self, length);
|
return_value = _sha3_shake_128_hexdigest_impl(self, length);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=2eb6db41778eeb50 input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=50cff05f2c74d41e input=a9049054013a1b77]*/
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
preserve
|
preserve
|
||||||
[clinic start generated code]*/
|
[clinic start generated code]*/
|
||||||
|
|
||||||
#if defined(PY_LONG_LONG)
|
|
||||||
|
|
||||||
PyDoc_STRVAR(SHA512Type_copy__doc__,
|
PyDoc_STRVAR(SHA512Type_copy__doc__,
|
||||||
"copy($self, /)\n"
|
"copy($self, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
|
@ -22,10 +20,6 @@ SHA512Type_copy(SHAobject *self, PyObject *Py_UNUSED(ignored))
|
||||||
return SHA512Type_copy_impl(self);
|
return SHA512Type_copy_impl(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(PY_LONG_LONG) */
|
|
||||||
|
|
||||||
#if defined(PY_LONG_LONG)
|
|
||||||
|
|
||||||
PyDoc_STRVAR(SHA512Type_digest__doc__,
|
PyDoc_STRVAR(SHA512Type_digest__doc__,
|
||||||
"digest($self, /)\n"
|
"digest($self, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
|
@ -44,10 +38,6 @@ SHA512Type_digest(SHAobject *self, PyObject *Py_UNUSED(ignored))
|
||||||
return SHA512Type_digest_impl(self);
|
return SHA512Type_digest_impl(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(PY_LONG_LONG) */
|
|
||||||
|
|
||||||
#if defined(PY_LONG_LONG)
|
|
||||||
|
|
||||||
PyDoc_STRVAR(SHA512Type_hexdigest__doc__,
|
PyDoc_STRVAR(SHA512Type_hexdigest__doc__,
|
||||||
"hexdigest($self, /)\n"
|
"hexdigest($self, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
|
@ -66,10 +56,6 @@ SHA512Type_hexdigest(SHAobject *self, PyObject *Py_UNUSED(ignored))
|
||||||
return SHA512Type_hexdigest_impl(self);
|
return SHA512Type_hexdigest_impl(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(PY_LONG_LONG) */
|
|
||||||
|
|
||||||
#if defined(PY_LONG_LONG)
|
|
||||||
|
|
||||||
PyDoc_STRVAR(SHA512Type_update__doc__,
|
PyDoc_STRVAR(SHA512Type_update__doc__,
|
||||||
"update($self, obj, /)\n"
|
"update($self, obj, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
|
@ -79,10 +65,6 @@ PyDoc_STRVAR(SHA512Type_update__doc__,
|
||||||
#define SHA512TYPE_UPDATE_METHODDEF \
|
#define SHA512TYPE_UPDATE_METHODDEF \
|
||||||
{"update", (PyCFunction)SHA512Type_update, METH_O, SHA512Type_update__doc__},
|
{"update", (PyCFunction)SHA512Type_update, METH_O, SHA512Type_update__doc__},
|
||||||
|
|
||||||
#endif /* defined(PY_LONG_LONG) */
|
|
||||||
|
|
||||||
#if defined(PY_LONG_LONG)
|
|
||||||
|
|
||||||
PyDoc_STRVAR(_sha512_sha512__doc__,
|
PyDoc_STRVAR(_sha512_sha512__doc__,
|
||||||
"sha512($module, /, string=b\'\')\n"
|
"sha512($module, /, string=b\'\')\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
|
@ -113,10 +95,6 @@ exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(PY_LONG_LONG) */
|
|
||||||
|
|
||||||
#if defined(PY_LONG_LONG)
|
|
||||||
|
|
||||||
PyDoc_STRVAR(_sha512_sha384__doc__,
|
PyDoc_STRVAR(_sha512_sha384__doc__,
|
||||||
"sha384($module, /, string=b\'\')\n"
|
"sha384($module, /, string=b\'\')\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
|
@ -146,30 +124,4 @@ _sha512_sha384(PyObject *module, PyObject *args, PyObject *kwargs)
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
/*[clinic end generated code: output=8f7f6603a9c4e910 input=a9049054013a1b77]*/
|
||||||
#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]*/
|
|
||||||
|
|
|
@ -113,13 +113,13 @@ PyDoc_STRVAR(msvcrt_open_osfhandle__doc__,
|
||||||
{"open_osfhandle", (PyCFunction)msvcrt_open_osfhandle, METH_VARARGS, msvcrt_open_osfhandle__doc__},
|
{"open_osfhandle", (PyCFunction)msvcrt_open_osfhandle, METH_VARARGS, msvcrt_open_osfhandle__doc__},
|
||||||
|
|
||||||
static long
|
static long
|
||||||
msvcrt_open_osfhandle_impl(PyObject *module, Py_intptr_t handle, int flags);
|
msvcrt_open_osfhandle_impl(PyObject *module, intptr_t handle, int flags);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
msvcrt_open_osfhandle(PyObject *module, PyObject *args)
|
msvcrt_open_osfhandle(PyObject *module, PyObject *args)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_intptr_t handle;
|
intptr_t handle;
|
||||||
int flags;
|
int flags;
|
||||||
long _return_value;
|
long _return_value;
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ PyDoc_STRVAR(msvcrt_get_osfhandle__doc__,
|
||||||
#define MSVCRT_GET_OSFHANDLE_METHODDEF \
|
#define MSVCRT_GET_OSFHANDLE_METHODDEF \
|
||||||
{"get_osfhandle", (PyCFunction)msvcrt_get_osfhandle, METH_O, msvcrt_get_osfhandle__doc__},
|
{"get_osfhandle", (PyCFunction)msvcrt_get_osfhandle, METH_O, msvcrt_get_osfhandle__doc__},
|
||||||
|
|
||||||
static Py_intptr_t
|
static intptr_t
|
||||||
msvcrt_get_osfhandle_impl(PyObject *module, int fd);
|
msvcrt_get_osfhandle_impl(PyObject *module, int fd);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -156,7 +156,7 @@ msvcrt_get_osfhandle(PyObject *module, PyObject *arg)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
int fd;
|
int fd;
|
||||||
Py_intptr_t _return_value;
|
intptr_t _return_value;
|
||||||
|
|
||||||
if (!PyArg_Parse(arg, "i:get_osfhandle", &fd)) {
|
if (!PyArg_Parse(arg, "i:get_osfhandle", &fd)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
|
@ -569,4 +569,4 @@ exit:
|
||||||
#ifndef MSVCRT_SET_ERROR_MODE_METHODDEF
|
#ifndef MSVCRT_SET_ERROR_MODE_METHODDEF
|
||||||
#define MSVCRT_SET_ERROR_MODE_METHODDEF
|
#define MSVCRT_SET_ERROR_MODE_METHODDEF
|
||||||
#endif /* !defined(MSVCRT_SET_ERROR_MODE_METHODDEF) */
|
#endif /* !defined(MSVCRT_SET_ERROR_MODE_METHODDEF) */
|
||||||
/*[clinic end generated code: output=ece8106c0592ff1f input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=ae04e2b50eef8b63 input=a9049054013a1b77]*/
|
||||||
|
|
|
@ -59,7 +59,7 @@ class wchar_t_return_converter(CReturnConverter):
|
||||||
data.return_conversion.append(
|
data.return_conversion.append(
|
||||||
'return_value = PyUnicode_FromOrdinal(_return_value);\n')
|
'return_value = PyUnicode_FromOrdinal(_return_value);\n')
|
||||||
[python start generated code]*/
|
[python start generated code]*/
|
||||||
/*[python end generated code: output=da39a3ee5e6b4b0d input=6a54fc4e73d0b367]*/
|
/*[python end generated code: output=da39a3ee5e6b4b0d input=b59f1663dba11997]*/
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
module msvcrt
|
module msvcrt
|
||||||
|
@ -161,7 +161,7 @@ to os.fdopen() to create a file object.
|
||||||
|
|
||||||
static long
|
static long
|
||||||
msvcrt_open_osfhandle_impl(PyObject *module, intptr_t handle, int flags)
|
msvcrt_open_osfhandle_impl(PyObject *module, intptr_t handle, int flags)
|
||||||
/*[clinic end generated code: output=bf65e422243a39f9 input=4d8516ed32db8f65]*/
|
/*[clinic end generated code: output=cede871bf939d6e3 input=cb2108bbea84514e]*/
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ Raises IOError if fd is not recognized.
|
||||||
|
|
||||||
static intptr_t
|
static intptr_t
|
||||||
msvcrt_get_osfhandle_impl(PyObject *module, int fd)
|
msvcrt_get_osfhandle_impl(PyObject *module, int fd)
|
||||||
/*[clinic end generated code: output=eac47643338c0baa input=c7d18d02c8017ec1]*/
|
/*[clinic end generated code: output=7ce761dd0de2b503 input=c7d18d02c8017ec1]*/
|
||||||
{
|
{
|
||||||
intptr_t handle = -1;
|
intptr_t handle = -1;
|
||||||
|
|
||||||
|
|
|
@ -2581,21 +2581,21 @@ class unsigned_long_converter(CConverter):
|
||||||
if not bitwise:
|
if not bitwise:
|
||||||
fail("Unsigned longs must be bitwise (for now).")
|
fail("Unsigned longs must be bitwise (for now).")
|
||||||
|
|
||||||
class PY_LONG_LONG_converter(CConverter):
|
class long_long_converter(CConverter):
|
||||||
type = 'PY_LONG_LONG'
|
type = 'long long'
|
||||||
default_type = int
|
default_type = int
|
||||||
format_unit = 'L'
|
format_unit = 'L'
|
||||||
c_ignored_default = "0"
|
c_ignored_default = "0"
|
||||||
|
|
||||||
class unsigned_PY_LONG_LONG_converter(CConverter):
|
class unsigned_long_long_converter(CConverter):
|
||||||
type = 'unsigned PY_LONG_LONG'
|
type = 'unsigned long long'
|
||||||
default_type = int
|
default_type = int
|
||||||
format_unit = 'K'
|
format_unit = 'K'
|
||||||
c_ignored_default = "0"
|
c_ignored_default = "0"
|
||||||
|
|
||||||
def converter_init(self, *, bitwise=False):
|
def converter_init(self, *, bitwise=False):
|
||||||
if not bitwise:
|
if not bitwise:
|
||||||
fail("Unsigned PY_LONG_LONGs must be bitwise (for now).")
|
fail("Unsigned long long must be bitwise (for now).")
|
||||||
|
|
||||||
class Py_ssize_t_converter(CConverter):
|
class Py_ssize_t_converter(CConverter):
|
||||||
type = 'Py_ssize_t'
|
type = 'Py_ssize_t'
|
||||||
|
|
Loading…
Reference in New Issue