pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/commit/6969eaf4682beb01bc95eeb14f5ce6c01312e297

bpo-29464: Rename METH_FASTCALL to METH_FASTCALL|METH_KEYWORDS and ma… · python/cpython@6969eaf · GitHub
Skip to content

Commit 6969eaf

Browse files
bpo-29464: Rename METH_FASTCALL to METH_FASTCALL|METH_KEYWORDS and make (#1955)
the bare METH_FASTCALL be used for functions with positional-only parameters.
1 parent aa0aa04 commit 6969eaf

76 files changed

Lines changed: 616 additions & 1916 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Include/methodobject.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ PyAPI_DATA(PyTypeObject) PyCFunction_Type;
1616
#define PyCFunction_Check(op) (Py_TYPE(op) == &PyCFunction_Type)
1717

1818
typedef PyObject *(*PyCFunction)(PyObject *, PyObject *);
19-
typedef PyObject *(*_PyCFunctionFast) (PyObject *self, PyObject **args,
20-
Py_ssize_t nargs, PyObject *kwnames);
19+
typedef PyObject *(*_PyCFunctionFast) (PyObject *, PyObject **, Py_ssize_t);
2120
typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *,
2221
PyObject *);
22+
typedef PyObject *(*_PyCFunctionFastWithKeywords) (PyObject *,
23+
PyObject **, Py_ssize_t,
24+
PyObject *);
2325
typedef PyObject *(*PyNoArgsFunction)(PyObject *);
2426

2527
PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject *);

Modules/_collectionsmodule.c

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -912,14 +912,10 @@ _deque_rotate(dequeobject *deque, Py_ssize_t n)
912912
}
913913

914914
static PyObject *
915-
deque_rotate(dequeobject *deque, PyObject **args, Py_ssize_t nargs,
916-
PyObject *kwnames)
915+
deque_rotate(dequeobject *deque, PyObject **args, Py_ssize_t nargs)
917916
{
918917
Py_ssize_t n=1;
919918

920-
if (!_PyArg_NoStackKeywords("rotate", kwnames)) {
921-
return NULL;
922-
}
923919
if (!_PyArg_ParseStack(args, nargs, "|n:rotate", &n)) {
924920
return NULL;
925921
}
@@ -1052,8 +1048,7 @@ deque_len(dequeobject *deque)
10521048
}
10531049

10541050
static PyObject *
1055-
deque_index(dequeobject *deque, PyObject **args, Py_ssize_t nargs,
1056-
PyObject *kwnames)
1051+
deque_index(dequeobject *deque, PyObject **args, Py_ssize_t nargs)
10571052
{
10581053
Py_ssize_t i, n, start=0, stop=Py_SIZE(deque);
10591054
PyObject *v, *item;
@@ -1062,9 +1057,6 @@ deque_index(dequeobject *deque, PyObject **args, Py_ssize_t nargs,
10621057
size_t start_state = deque->state;
10631058
int cmp;
10641059

1065-
if (!_PyArg_NoStackKeywords("index", kwnames)) {
1066-
return NULL;
1067-
}
10681060
if (!_PyArg_ParseStack(args, nargs, "O|O&O&:index", &v,
10691061
_PyEval_SliceIndexNotNone, &start,
10701062
_PyEval_SliceIndexNotNone, &stop)) {
@@ -1133,17 +1125,13 @@ PyDoc_STRVAR(index_doc,
11331125
*/
11341126

11351127
static PyObject *
1136-
deque_insert(dequeobject *deque, PyObject **args, Py_ssize_t nargs,
1137-
PyObject *kwnames)
1128+
deque_insert(dequeobject *deque, PyObject **args, Py_ssize_t nargs)
11381129
{
11391130
Py_ssize_t index;
11401131
Py_ssize_t n = Py_SIZE(deque);
11411132
PyObject *value;
11421133
PyObject *rv;
11431134

1144-
if (!_PyArg_NoStackKeywords("insert", kwnames)) {
1145-
return NULL;
1146-
}
11471135
if (!_PyArg_ParseStack(args, nargs, "nO:insert", &index, &value)) {
11481136
return NULL;
11491137
}

Modules/_elementtree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2774,7 +2774,7 @@ typedef struct {
27742774
} XMLParserObject;
27752775

27762776
static PyObject*
2777-
_elementtree_XMLParser_doctype(XMLParserObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames);
2777+
_elementtree_XMLParser_doctype(XMLParserObject *self, PyObject **args, Py_ssize_t nargs);
27782778
static PyObject *
27792779
_elementtree_XMLParser_doctype_impl(XMLParserObject *self, PyObject *name,
27802780
PyObject *pubid, PyObject *system);

Modules/_hashopenssl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ generate_hash_name_list(void)
967967

968968
/* a PyMethodDef structure for the constructor */
969969
#define CONSTRUCTOR_METH_DEF(NAME) \
970-
{"openssl_" #NAME, (PyCFunction)EVP_new_ ## NAME, METH_FASTCALL, \
970+
{"openssl_" #NAME, (PyCFunction)EVP_new_ ## NAME, METH_FASTCALL | METH_KEYWORDS, \
971971
PyDoc_STR("Returns a " #NAME \
972972
" hash object; optionally initialized with a string") \
973973
}

Modules/_io/clinic/_iomodule.c.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ PyDoc_STRVAR(_io_open__doc__,
127127
"opened in a binary mode.");
128128

129129
#define _IO_OPEN_METHODDEF \
130-
{"open", (PyCFunction)_io_open, METH_FASTCALL, _io_open__doc__},
130+
{"open", (PyCFunction)_io_open, METH_FASTCALL|METH_KEYWORDS, _io_open__doc__},
131131

132132
static PyObject *
133133
_io_open_impl(PyObject *module, PyObject *file, const char *mode,
@@ -158,4 +158,4 @@ _io_open(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
158158
exit:
159159
return return_value;
160160
}
161-
/*[clinic end generated code: output=e6011c784fe6589b input=a9049054013a1b77]*/
161+
/*[clinic end generated code: output=7e0ab289d8465580 input=a9049054013a1b77]*/

Modules/_io/clinic/bufferedio.c.h

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,11 @@ static PyObject *
9797
_io__Buffered_peek_impl(buffered *self, Py_ssize_t size);
9898

9999
static PyObject *
100-
_io__Buffered_peek(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
100+
_io__Buffered_peek(buffered *self, PyObject **args, Py_ssize_t nargs)
101101
{
102102
PyObject *return_value = NULL;
103103
Py_ssize_t size = 0;
104104

105-
if (!_PyArg_NoStackKeywords("peek", kwnames)) {
106-
goto exit;
107-
}
108-
109105
if (!_PyArg_ParseStack(args, nargs, "|n:peek",
110106
&size)) {
111107
goto exit;
@@ -128,15 +124,11 @@ static PyObject *
128124
_io__Buffered_read_impl(buffered *self, Py_ssize_t n);
129125

130126
static PyObject *
131-
_io__Buffered_read(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
127+
_io__Buffered_read(buffered *self, PyObject **args, Py_ssize_t nargs)
132128
{
133129
PyObject *return_value = NULL;
134130
Py_ssize_t n = -1;
135131

136-
if (!_PyArg_NoStackKeywords("read", kwnames)) {
137-
goto exit;
138-
}
139-
140132
if (!_PyArg_ParseStack(args, nargs, "|O&:read",
141133
_Py_convert_optional_to_ssize_t, &n)) {
142134
goto exit;
@@ -159,15 +151,11 @@ static PyObject *
159151
_io__Buffered_read1_impl(buffered *self, Py_ssize_t n);
160152

161153
static PyObject *
162-
_io__Buffered_read1(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
154+
_io__Buffered_read1(buffered *self, PyObject **args, Py_ssize_t nargs)
163155
{
164156
PyObject *return_value = NULL;
165157
Py_ssize_t n = -1;
166158

167-
if (!_PyArg_NoStackKeywords("read1", kwnames)) {
168-
goto exit;
169-
}
170-
171159
if (!_PyArg_ParseStack(args, nargs, "|n:read1",
172160
&n)) {
173161
goto exit;
@@ -252,15 +240,11 @@ static PyObject *
252240
_io__Buffered_readline_impl(buffered *self, Py_ssize_t size);
253241

254242
static PyObject *
255-
_io__Buffered_readline(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
243+
_io__Buffered_readline(buffered *self, PyObject **args, Py_ssize_t nargs)
256244
{
257245
PyObject *return_value = NULL;
258246
Py_ssize_t size = -1;
259247

260-
if (!_PyArg_NoStackKeywords("readline", kwnames)) {
261-
goto exit;
262-
}
263-
264248
if (!_PyArg_ParseStack(args, nargs, "|O&:readline",
265249
_Py_convert_optional_to_ssize_t, &size)) {
266250
goto exit;
@@ -283,16 +267,12 @@ static PyObject *
283267
_io__Buffered_seek_impl(buffered *self, PyObject *targetobj, int whence);
284268

285269
static PyObject *
286-
_io__Buffered_seek(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
270+
_io__Buffered_seek(buffered *self, PyObject **args, Py_ssize_t nargs)
287271
{
288272
PyObject *return_value = NULL;
289273
PyObject *targetobj;
290274
int whence = 0;
291275

292-
if (!_PyArg_NoStackKeywords("seek", kwnames)) {
293-
goto exit;
294-
}
295-
296276
if (!_PyArg_ParseStack(args, nargs, "O|i:seek",
297277
&targetobj, &whence)) {
298278
goto exit;
@@ -315,15 +295,11 @@ static PyObject *
315295
_io__Buffered_truncate_impl(buffered *self, PyObject *pos);
316296

317297
static PyObject *
318-
_io__Buffered_truncate(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
298+
_io__Buffered_truncate(buffered *self, PyObject **args, Py_ssize_t nargs)
319299
{
320300
PyObject *return_value = NULL;
321301
PyObject *pos = Py_None;
322302

323-
if (!_PyArg_NoStackKeywords("truncate", kwnames)) {
324-
goto exit;
325-
}
326-
327303
if (!_PyArg_UnpackStack(args, nargs, "truncate",
328304
0, 1,
329305
&pos)) {
@@ -500,4 +476,4 @@ _io_BufferedRandom___init__(PyObject *self, PyObject *args, PyObject *kwargs)
500476
exit:
501477
return return_value;
502478
}
503-
/*[clinic end generated code: output=4f7490f82427c63b input=a9049054013a1b77]*/
479+
/*[clinic end generated code: output=2b817df0bf814ddc input=a9049054013a1b77]*/

Modules/_io/clinic/bytesio.c.h

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,11 @@ static PyObject *
164164
_io_BytesIO_read_impl(bytesio *self, Py_ssize_t size);
165165

166166
static PyObject *
167-
_io_BytesIO_read(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
167+
_io_BytesIO_read(bytesio *self, PyObject **args, Py_ssize_t nargs)
168168
{
169169
PyObject *return_value = NULL;
170170
Py_ssize_t size = -1;
171171

172-
if (!_PyArg_NoStackKeywords("read", kwnames)) {
173-
goto exit;
174-
}
175-
176172
if (!_PyArg_ParseStack(args, nargs, "|O&:read",
177173
_Py_convert_optional_to_ssize_t, &size)) {
178174
goto exit;
@@ -199,15 +195,11 @@ static PyObject *
199195
_io_BytesIO_read1_impl(bytesio *self, Py_ssize_t size);
200196

201197
static PyObject *
202-
_io_BytesIO_read1(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
198+
_io_BytesIO_read1(bytesio *self, PyObject **args, Py_ssize_t nargs)
203199
{
204200
PyObject *return_value = NULL;
205201
Py_ssize_t size = -1;
206202

207-
if (!_PyArg_NoStackKeywords("read1", kwnames)) {
208-
goto exit;
209-
}
210-
211203
if (!_PyArg_ParseStack(args, nargs, "|O&:read1",
212204
_Py_convert_optional_to_ssize_t, &size)) {
213205
goto exit;
@@ -235,15 +227,11 @@ static PyObject *
235227
_io_BytesIO_readline_impl(bytesio *self, Py_ssize_t size);
236228

237229
static PyObject *
238-
_io_BytesIO_readline(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
230+
_io_BytesIO_readline(bytesio *self, PyObject **args, Py_ssize_t nargs)
239231
{
240232
PyObject *return_value = NULL;
241233
Py_ssize_t size = -1;
242234

243-
if (!_PyArg_NoStackKeywords("readline", kwnames)) {
244-
goto exit;
245-
}
246-
247235
if (!_PyArg_ParseStack(args, nargs, "|O&:readline",
248236
_Py_convert_optional_to_ssize_t, &size)) {
249237
goto exit;
@@ -271,15 +259,11 @@ static PyObject *
271259
_io_BytesIO_readlines_impl(bytesio *self, PyObject *arg);
272260

273261
static PyObject *
274-
_io_BytesIO_readlines(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
262+
_io_BytesIO_readlines(bytesio *self, PyObject **args, Py_ssize_t nargs)
275263
{
276264
PyObject *return_value = NULL;
277265
PyObject *arg = Py_None;
278266

279-
if (!_PyArg_NoStackKeywords("readlines", kwnames)) {
280-
goto exit;
281-
}
282-
283267
if (!_PyArg_UnpackStack(args, nargs, "readlines",
284268
0, 1,
285269
&arg)) {
@@ -342,15 +326,11 @@ static PyObject *
342326
_io_BytesIO_truncate_impl(bytesio *self, Py_ssize_t size);
343327

344328
static PyObject *
345-
_io_BytesIO_truncate(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
329+
_io_BytesIO_truncate(bytesio *self, PyObject **args, Py_ssize_t nargs)
346330
{
347331
PyObject *return_value = NULL;
348332
Py_ssize_t size = self->pos;
349333

350-
if (!_PyArg_NoStackKeywords("truncate", kwnames)) {
351-
goto exit;
352-
}
353-
354334
if (!_PyArg_ParseStack(args, nargs, "|O&:truncate",
355335
_Py_convert_optional_to_ssize_t, &size)) {
356336
goto exit;
@@ -380,16 +360,12 @@ static PyObject *
380360
_io_BytesIO_seek_impl(bytesio *self, Py_ssize_t pos, int whence);
381361

382362
static PyObject *
383-
_io_BytesIO_seek(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
363+
_io_BytesIO_seek(bytesio *self, PyObject **args, Py_ssize_t nargs)
384364
{
385365
PyObject *return_value = NULL;
386366
Py_ssize_t pos;
387367
int whence = 0;
388368

389-
if (!_PyArg_NoStackKeywords("seek", kwnames)) {
390-
goto exit;
391-
}
392-
393369
if (!_PyArg_ParseStack(args, nargs, "n|i:seek",
394370
&pos, &whence)) {
395371
goto exit;
@@ -468,4 +444,4 @@ _io_BytesIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
468444
exit:
469445
return return_value;
470446
}
471-
/*[clinic end generated code: output=9e63715414bffb2a input=a9049054013a1b77]*/
447+
/*[clinic end generated code: output=20946f5a2ed4492b input=a9049054013a1b77]*/

Modules/_io/clinic/fileio.c.h

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -208,15 +208,11 @@ static PyObject *
208208
_io_FileIO_read_impl(fileio *self, Py_ssize_t size);
209209

210210
static PyObject *
211-
_io_FileIO_read(fileio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
211+
_io_FileIO_read(fileio *self, PyObject **args, Py_ssize_t nargs)
212212
{
213213
PyObject *return_value = NULL;
214214
Py_ssize_t size = -1;
215215

216-
if (!_PyArg_NoStackKeywords("read", kwnames)) {
217-
goto exit;
218-
}
219-
220216
if (!_PyArg_ParseStack(args, nargs, "|O&:read",
221217
_Py_convert_optional_to_ssize_t, &size)) {
222218
goto exit;
@@ -284,16 +280,12 @@ static PyObject *
284280
_io_FileIO_seek_impl(fileio *self, PyObject *pos, int whence);
285281

286282
static PyObject *
287-
_io_FileIO_seek(fileio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
283+
_io_FileIO_seek(fileio *self, PyObject **args, Py_ssize_t nargs)
288284
{
289285
PyObject *return_value = NULL;
290286
PyObject *pos;
291287
int whence = 0;
292288

293-
if (!_PyArg_NoStackKeywords("seek", kwnames)) {
294-
goto exit;
295-
}
296-
297289
if (!_PyArg_ParseStack(args, nargs, "O|i:seek",
298290
&pos, &whence)) {
299291
goto exit;
@@ -342,15 +334,11 @@ static PyObject *
342334
_io_FileIO_truncate_impl(fileio *self, PyObject *posobj);
343335

344336
static PyObject *
345-
_io_FileIO_truncate(fileio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
337+
_io_FileIO_truncate(fileio *self, PyObject **args, Py_ssize_t nargs)
346338
{
347339
PyObject *return_value = NULL;
348340
PyObject *posobj = NULL;
349341

350-
if (!_PyArg_NoStackKeywords("truncate", kwnames)) {
351-
goto exit;
352-
}
353-
354342
if (!_PyArg_UnpackStack(args, nargs, "truncate",
355343
0, 1,
356344
&posobj)) {
@@ -385,4 +373,4 @@ _io_FileIO_isatty(fileio *self, PyObject *Py_UNUSED(ignored))
385373
#ifndef _IO_FILEIO_TRUNCATE_METHODDEF
386374
#define _IO_FILEIO_TRUNCATE_METHODDEF
387375
#endif /* !defined(_IO_FILEIO_TRUNCATE_METHODDEF) */
388-
/*[clinic end generated code: output=2c6a5470100a8f10 input=a9049054013a1b77]*/
376+
/*[clinic end generated code: output=1af8b4031633b763 input=a9049054013a1b77]*/

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy