Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cc85449

Browse files
committed
clinic: PY_LONG_LONG -> long long
1 parent c235af4 commit cc85449

6 files changed

Lines changed: 32 additions & 74 deletions

File tree

Doc/howto/clinic.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -827,9 +827,9 @@ on the right is the text you'd replace it with.
827827
``'i'`` ``int``
828828
``'I'`` ``unsigned_int(bitwise=True)``
829829
``'k'`` ``unsigned_long(bitwise=True)``
830-
``'K'`` ``unsigned_PY_LONG_LONG(bitwise=True)``
830+
``'K'`` ``unsigned_long_long(bitwise=True)``
831831
``'l'`` ``long``
832-
``'L'`` ``PY_LONG_LONG``
832+
``'L'`` ``long long``
833833
``'n'`` ``Py_ssize_t``
834834
``'O'`` ``object``
835835
``'O!'`` ``object(subclass_of='&PySomething_Type')``

Modules/_sha3/clinic/sha3module.c.h

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ static PyObject *
1515
py_sha3_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1616
{
1717
PyObject *return_value = NULL;
18-
static char *_keywords[] = {"string", NULL};
18+
static const char * const _keywords[] = {"string", NULL};
19+
static _PyArg_Parser _parser = {"|O:sha3_224", _keywords, 0};
1920
PyObject *data = NULL;
2021

21-
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:sha3_224", _keywords,
22-
&data))
22+
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
23+
&data)) {
2324
goto exit;
25+
}
2426
return_value = py_sha3_new_impl(type, data);
2527

2628
exit:
@@ -106,12 +108,14 @@ static PyObject *
106108
_sha3_shake_128_digest(SHA3object *self, PyObject *args, PyObject *kwargs)
107109
{
108110
PyObject *return_value = NULL;
109-
static char *_keywords[] = {"length", NULL};
111+
static const char * const _keywords[] = {"length", NULL};
112+
static _PyArg_Parser _parser = {"k:digest", _keywords, 0};
110113
unsigned long length;
111114

112-
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "k:digest", _keywords,
113-
&length))
115+
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
116+
&length)) {
114117
goto exit;
118+
}
115119
return_value = _sha3_shake_128_digest_impl(self, length);
116120

117121
exit:
@@ -134,15 +138,17 @@ static PyObject *
134138
_sha3_shake_128_hexdigest(SHA3object *self, PyObject *args, PyObject *kwargs)
135139
{
136140
PyObject *return_value = NULL;
137-
static char *_keywords[] = {"length", NULL};
141+
static const char * const _keywords[] = {"length", NULL};
142+
static _PyArg_Parser _parser = {"k:hexdigest", _keywords, 0};
138143
unsigned long length;
139144

140-
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "k:hexdigest", _keywords,
141-
&length))
145+
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
146+
&length)) {
142147
goto exit;
148+
}
143149
return_value = _sha3_shake_128_hexdigest_impl(self, length);
144150

145151
exit:
146152
return return_value;
147153
}
148-
/*[clinic end generated code: output=2eb6db41778eeb50 input=a9049054013a1b77]*/
154+
/*[clinic end generated code: output=50cff05f2c74d41e input=a9049054013a1b77]*/

Modules/clinic/sha512module.c.h

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
preserve
33
[clinic start generated code]*/
44

5-
#if defined(PY_LONG_LONG)
6-
75
PyDoc_STRVAR(SHA512Type_copy__doc__,
86
"copy($self, /)\n"
97
"--\n"
@@ -22,10 +20,6 @@ SHA512Type_copy(SHAobject *self, PyObject *Py_UNUSED(ignored))
2220
return SHA512Type_copy_impl(self);
2321
}
2422

25-
#endif /* defined(PY_LONG_LONG) */
26-
27-
#if defined(PY_LONG_LONG)
28-
2923
PyDoc_STRVAR(SHA512Type_digest__doc__,
3024
"digest($self, /)\n"
3125
"--\n"
@@ -44,10 +38,6 @@ SHA512Type_digest(SHAobject *self, PyObject *Py_UNUSED(ignored))
4438
return SHA512Type_digest_impl(self);
4539
}
4640

47-
#endif /* defined(PY_LONG_LONG) */
48-
49-
#if defined(PY_LONG_LONG)
50-
5141
PyDoc_STRVAR(SHA512Type_hexdigest__doc__,
5242
"hexdigest($self, /)\n"
5343
"--\n"
@@ -66,10 +56,6 @@ SHA512Type_hexdigest(SHAobject *self, PyObject *Py_UNUSED(ignored))
6656
return SHA512Type_hexdigest_impl(self);
6757
}
6858

69-
#endif /* defined(PY_LONG_LONG) */
70-
71-
#if defined(PY_LONG_LONG)
72-
7359
PyDoc_STRVAR(SHA512Type_update__doc__,
7460
"update($self, obj, /)\n"
7561
"--\n"
@@ -79,10 +65,6 @@ PyDoc_STRVAR(SHA512Type_update__doc__,
7965
#define SHA512TYPE_UPDATE_METHODDEF \
8066
{"update", (PyCFunction)SHA512Type_update, METH_O, SHA512Type_update__doc__},
8167

82-
#endif /* defined(PY_LONG_LONG) */
83-
84-
#if defined(PY_LONG_LONG)
85-
8668
PyDoc_STRVAR(_sha512_sha512__doc__,
8769
"sha512($module, /, string=b\'\')\n"
8870
"--\n"
@@ -113,10 +95,6 @@ _sha512_sha512(PyObject *module, PyObject *args, PyObject *kwargs)
11395
return return_value;
11496
}
11597

116-
#endif /* defined(PY_LONG_LONG) */
117-
118-
#if defined(PY_LONG_LONG)
119-
12098
PyDoc_STRVAR(_sha512_sha384__doc__,
12199
"sha384($module, /, string=b\'\')\n"
122100
"--\n"
@@ -146,30 +124,4 @@ _sha512_sha384(PyObject *module, PyObject *args, PyObject *kwargs)
146124
exit:
147125
return return_value;
148126
}
149-
150-
#endif /* defined(PY_LONG_LONG) */
151-
152-
#ifndef SHA512TYPE_COPY_METHODDEF
153-
#define SHA512TYPE_COPY_METHODDEF
154-
#endif /* !defined(SHA512TYPE_COPY_METHODDEF) */
155-
156-
#ifndef SHA512TYPE_DIGEST_METHODDEF
157-
#define SHA512TYPE_DIGEST_METHODDEF
158-
#endif /* !defined(SHA512TYPE_DIGEST_METHODDEF) */
159-
160-
#ifndef SHA512TYPE_HEXDIGEST_METHODDEF
161-
#define SHA512TYPE_HEXDIGEST_METHODDEF
162-
#endif /* !defined(SHA512TYPE_HEXDIGEST_METHODDEF) */
163-
164-
#ifndef SHA512TYPE_UPDATE_METHODDEF
165-
#define SHA512TYPE_UPDATE_METHODDEF
166-
#endif /* !defined(SHA512TYPE_UPDATE_METHODDEF) */
167-
168-
#ifndef _SHA512_SHA512_METHODDEF
169-
#define _SHA512_SHA512_METHODDEF
170-
#endif /* !defined(_SHA512_SHA512_METHODDEF) */
171-
172-
#ifndef _SHA512_SHA384_METHODDEF
173-
#define _SHA512_SHA384_METHODDEF
174-
#endif /* !defined(_SHA512_SHA384_METHODDEF) */
175-
/*[clinic end generated code: output=cf0da76cb603d1bf input=a9049054013a1b77]*/
127+
/*[clinic end generated code: output=8f7f6603a9c4e910 input=a9049054013a1b77]*/

PC/clinic/msvcrtmodule.c.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,13 @@ PyDoc_STRVAR(msvcrt_open_osfhandle__doc__,
113113
{"open_osfhandle", (PyCFunction)msvcrt_open_osfhandle, METH_VARARGS, msvcrt_open_osfhandle__doc__},
114114

115115
static long
116-
msvcrt_open_osfhandle_impl(PyObject *module, Py_intptr_t handle, int flags);
116+
msvcrt_open_osfhandle_impl(PyObject *module, intptr_t handle, int flags);
117117

118118
static PyObject *
119119
msvcrt_open_osfhandle(PyObject *module, PyObject *args)
120120
{
121121
PyObject *return_value = NULL;
122-
Py_intptr_t handle;
122+
intptr_t handle;
123123
int flags;
124124
long _return_value;
125125

@@ -148,15 +148,15 @@ PyDoc_STRVAR(msvcrt_get_osfhandle__doc__,
148148
#define MSVCRT_GET_OSFHANDLE_METHODDEF \
149149
{"get_osfhandle", (PyCFunction)msvcrt_get_osfhandle, METH_O, msvcrt_get_osfhandle__doc__},
150150

151-
static Py_intptr_t
151+
static intptr_t
152152
msvcrt_get_osfhandle_impl(PyObject *module, int fd);
153153

154154
static PyObject *
155155
msvcrt_get_osfhandle(PyObject *module, PyObject *arg)
156156
{
157157
PyObject *return_value = NULL;
158158
int fd;
159-
Py_intptr_t _return_value;
159+
intptr_t _return_value;
160160

161161
if (!PyArg_Parse(arg, "i:get_osfhandle", &fd)) {
162162
goto exit;
@@ -569,4 +569,4 @@ msvcrt_SetErrorMode(PyObject *module, PyObject *arg)
569569
#ifndef MSVCRT_SET_ERROR_MODE_METHODDEF
570570
#define MSVCRT_SET_ERROR_MODE_METHODDEF
571571
#endif /* !defined(MSVCRT_SET_ERROR_MODE_METHODDEF) */
572-
/*[clinic end generated code: output=ece8106c0592ff1f input=a9049054013a1b77]*/
572+
/*[clinic end generated code: output=ae04e2b50eef8b63 input=a9049054013a1b77]*/

PC/msvcrtmodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class wchar_t_return_converter(CReturnConverter):
5959
data.return_conversion.append(
6060
'return_value = PyUnicode_FromOrdinal(_return_value);\n')
6161
[python start generated code]*/
62-
/*[python end generated code: output=da39a3ee5e6b4b0d input=6a54fc4e73d0b367]*/
62+
/*[python end generated code: output=da39a3ee5e6b4b0d input=b59f1663dba11997]*/
6363

6464
/*[clinic input]
6565
module msvcrt
@@ -161,7 +161,7 @@ to os.fdopen() to create a file object.
161161

162162
static long
163163
msvcrt_open_osfhandle_impl(PyObject *module, intptr_t handle, int flags)
164-
/*[clinic end generated code: output=bf65e422243a39f9 input=4d8516ed32db8f65]*/
164+
/*[clinic end generated code: output=cede871bf939d6e3 input=cb2108bbea84514e]*/
165165
{
166166
int fd;
167167

@@ -185,7 +185,7 @@ Raises IOError if fd is not recognized.
185185

186186
static intptr_t
187187
msvcrt_get_osfhandle_impl(PyObject *module, int fd)
188-
/*[clinic end generated code: output=eac47643338c0baa input=c7d18d02c8017ec1]*/
188+
/*[clinic end generated code: output=7ce761dd0de2b503 input=c7d18d02c8017ec1]*/
189189
{
190190
intptr_t handle = -1;
191191

Tools/clinic/clinic.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2581,21 +2581,21 @@ def converter_init(self, *, bitwise=False):
25812581
if not bitwise:
25822582
fail("Unsigned longs must be bitwise (for now).")
25832583

2584-
class PY_LONG_LONG_converter(CConverter):
2585-
type = 'PY_LONG_LONG'
2584+
class long_long_converter(CConverter):
2585+
type = 'long long'
25862586
default_type = int
25872587
format_unit = 'L'
25882588
c_ignored_default = "0"
25892589

2590-
class unsigned_PY_LONG_LONG_converter(CConverter):
2591-
type = 'unsigned PY_LONG_LONG'
2590+
class unsigned_long_long_converter(CConverter):
2591+
type = 'unsigned long long'
25922592
default_type = int
25932593
format_unit = 'K'
25942594
c_ignored_default = "0"
25952595

25962596
def converter_init(self, *, bitwise=False):
25972597
if not bitwise:
2598-
fail("Unsigned PY_LONG_LONGs must be bitwise (for now).")
2598+
fail("Unsigned long long must be bitwise (for now).")
25992599

26002600
class Py_ssize_t_converter(CConverter):
26012601
type = 'Py_ssize_t'

0 commit comments

Comments
 (0)