8000 Merge branch 3.8 into 3.8-slp · stackless-dev/stackless@e818b60 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit e818b60

Browse files
author
Anselm Kruis
committed
Merge branch 3.8 into 3.8-slp
Run python Tools/clinic/clinic.py -f --make
2 parents f784a53 + 96631dc commit e818b60

Some content is hidden

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

63 files changed

+625
-555
lines changed

Include/modsupport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ PyAPI_FUNC(int) _PyArg_NoPositional(const char *funcname, PyObject *args);
6666
#define _PyArg_NoPositional(funcname, args) \
6767
((args) == NULL || _PyArg_NoPositional((funcname), (args)))
6868

69-
PyAPI_FUNC(void) _PyArg_BadArgument(const char *, int, const char *, PyObject *);
69+
PyAPI_FUNC(void) _PyArg_BadArgument(const char *, const char *, const char *, PyObject *);
7070
PyAPI_FUNC(int) _PyArg_CheckPositional(const char *, Py_ssize_t,
7171
Py_ssize_t, Py_ssize_t);
7272
#define _PyArg_CheckPositional(funcname, nargs, min, max) \

Lib/test/clinic.test

Lines changed: 94 additions & 41 deletions
Large diffs are not rendered by default.

Lib/test/test_pyexpat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def test_illegal(self):
285285
self.fail()
286286
except TypeError as e:
287287
self.assertEqual(str(e),
288-
'ParserCreate() argument 2 must be str or None, not int')
288+
"ParserCreate() argument 'namespace_separator' must be str or None, not int")
289289

290290
try:
291291
expat.ParserCreate(namespace_separator='too long')
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Argument Clinic now uses the argument name on errors with keyword-only
2+
argument instead of their position. Patch contributed by Rémi Lapeyre.

Modules/_blake2/clinic/blake2b_impl.c.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ py_blake2b_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
7272
goto exit;
7373
}
7474
if (!PyBuffer_IsContiguous(&key, 'C')) {
75-
_PyArg_BadArgument("blake2b", 3, "contiguous buffer", fastargs[2]);
75+
_PyArg_BadArgument("blake2b", "argument 'key'", "contiguous buffer", fastargs[2]);
7676
goto exit;
7777
}
7878
if (!--noptargs) {
@@ -84,7 +84,7 @@ py_blake2b_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
8484
goto exit;
8585
}
8686
if (!PyBuffer_IsContiguous(&salt, 'C')) {
87-
_PyArg_BadArgument("blake2b", 4, "contiguous buffer", fastargs[3]);
87+
_PyArg_BadArgument("blake2b", "argument 'salt'", "contiguous buffer", fastargs[3]);
8888
goto exit;
8989
}
9090
if (!--noptargs) {
@@ -96,7 +96,7 @@ py_blake2b_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
9696
goto exit;
9797
}
9898
if (!PyBuffer_IsContiguous(&person, 'C')) {
99-
_PyArg_BadArgument("blake2b", 5, "contiguous buffer", fastargs[4]);
99+
_PyArg_BadArgument("blake2b", "argument 'person'", "contiguous buffer", fastargs[4]);
100100
goto exit;
101101
}
102102
if (!--noptargs) {
@@ -261,4 +261,4 @@ _blake2_blake2b_hexdigest(BLAKE2bObject *self, PyObject *Py_UNUSED(ignored))
261261
{
262262
return _blake2_blake2b_hexdigest_impl(self);
263263
}
264-
/*[clinic end generated code: output=a91d182ce1109f34 input=a9049054013a1b77]*/
264+
/*[clinic end generated code: output=cbb625d7f60c288c input=a9049054013a1b77]*/

Modules/_blake2/clinic/blake2s_impl.c.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ py_blake2s_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
7272
goto exit;
7373
}
7474
if (!PyBuffer_IsContiguous(&key, 'C')) {
75-
_PyArg_BadArgument("blake2s", 3, "contiguous buffer", fastargs[2]);
75+
_PyArg_BadArgument("blake2s", "argument 'key'", "contiguous buffer", fastargs[2]);
7676
goto exit;
7777
}
7878
if (!--noptargs) {
@@ -84,7 +84,7 @@ py_blake2s_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
8484
goto exit;
8585
}
8686
if (!PyBuffer_IsContiguous(&salt, 'C')) {
87-
_PyArg_BadArgument("blake2s", 4, "contiguous buffer", fastargs[3]);
87+
_PyArg_BadArgument("blake2s", "argument 'salt'", "contiguous buffer", fastargs[3]);
8888
goto exit;
8989
}
9090
if (!--noptargs) {
@@ -96,7 +96,7 @@ py_blake2s_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
9696
goto exit;
9797
}
9898
if (!PyBuffer_IsContiguous(&person, 'C')) {
99-
_PyArg_BadArgument("blake2s", 5, "contiguous buffer", fastargs[4]);
99+
_PyArg_BadArgument("blake2s", "argument 'person'", "contiguous buffer", fastargs[4]);
100100
goto exit;
101101
}
102102
if (!--noptargs) {
@@ -261,4 +261,4 @@ _blake2_blake2s_hexdigest(BLAKE2sObject *self, PyObject *Py_UNUSED(ignored))
261261
{
262262
return _blake2_blake2s_hexdigest_impl(self);
263263
}
264-
/*[clinic end generated code: output=ae8e9b7301d092b4 input=a9049054013a1b77]*/
264+
/*[clinic end generated code: output=39af5a74c8805b36 input=a9049054013a1b77]*/

Modules/_io/clinic/_iomodule.c.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ _io_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
161161
}
162162
if (args[1]) {
163163
if (!PyUnicode_Check(args[1])) {
164-
_PyArg_BadArgument("open", 2, "str", args[1]);
164+
_PyArg_BadArgument("open", "argument 'mode'", "str", args[1]);
165165
goto exit;
166166
}
167167
Py_ssize_t mode_length;
@@ -207,7 +207,7 @@ _io_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
207207
}
208208
}
209209
else {
210-
_PyArg_BadArgument("open", 4, "str or None", args[3]);
210+
_PyArg_BadArgument("open", "argument 'encoding'", "str or None", args[3]);
211211
goto exit;
212212
}
213213
if (!--noptargs) {
@@ -230,7 +230,7 @@ _io_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
230230
}
231231
}
232232
else {
233-
_PyArg_BadArgument("open", 5, "str or None", args[4]);
233+
_PyArg_BadArgument("open", "argument 'errors'", "str or None", args[4]);
234234
goto exit;
235235
}
236236
if (!--noptargs) {
@@ -253,7 +253,7 @@ _io_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
253253
}
254254
}
255255
else {
256-
_PyArg_BadArgument("open", 6, "str or None", args[5]);
256+
_PyArg_BadArgument("open", "argument 'newline'", "str or None", args[5]);
257257
goto exit;
258258
}
259259
if (!--noptargs) {
@@ -311,7 +311,7 @@ _io_open_code(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
311311
goto exit;
312312
}
313313
if (!PyUnicode_Check(args[0])) {
314-
_PyArg_BadArgument("open_code", 1, "str", args[0]);
314+
_PyArg_BadArgument("open_code", "argument 'path'", "str", args[0]);
315315
goto exit;
316316
}
317317
if (PyUnicode_READY(args[0]) == -1) {
@@ -323,4 +323,4 @@ _io_open_code(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
323323
exit:
324324
return return_value;
325325
}
326-
/*[clinic end generated code: output=d479285078750d68 input=a9049054013a1b77]*/
326+
/*[clinic end generated code: output=3df6bc6d91697545 input=a9049054013a1b77]*/

Modules/_io/clinic/bufferedio.c.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ _io__BufferedIOBase_readinto(PyObject *self, PyObject *arg)
2121

2222
if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
2323
PyErr_Clear();
24-
_PyArg_BadArgument("readinto", 0, "read-write bytes-like object", arg);
24+
_PyArg_BadArgument("readinto", "argument", "read-write bytes-like object", arg);
2525
goto exit;
2626
}
2727
if (!PyBuffer_IsContiguous(&buffer, 'C')) {
28-
_PyArg_BadArgument("readinto", 0, "contiguous buffer", arg);
28+
_PyArg_BadArgument("readinto", "argument", "contiguous buffer", arg);
2929
goto exit;
3030
}
3131
return_value = _io__BufferedIOBase_readinto_impl(self, &buffer);
@@ -58,11 +58,11 @@ _io__BufferedIOBase_readinto1(PyObject *self, PyObject *arg)
5858

5959
if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
6060
PyErr_Clear();
61-
_PyArg_BadArgument("readinto1", 0, "read-write bytes-like object", arg);
61+
_PyArg_BadArgument("readinto1", "argument", "read-write bytes-like object", arg);
6262
goto exit;
6363
}
6464
if (!PyBuffer_IsContiguous(&buffer, 'C')) {
65-
_PyArg_BadArgument("readinto1", 0, "contiguous buffer", arg);
65+
_PyArg_BadArgument("readinto1", "argument", "contiguous buffer", arg);
6666
goto exit;
6767
}
6868
return_value = _io__BufferedIOBase_readinto1_impl(self, &buffer);
@@ -243,11 +243,11 @@ _io__Buffered_readinto(buffered *self, PyObject *arg)
243243

244244
if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
245245
PyErr_Clear();
246-
_PyArg_BadArgument("readinto", 0, "read-write bytes-like object", arg);
246+
_PyArg_BadArgument("readinto", "argument", "read-write bytes-like object", arg);
247247
goto exit;
248248
}
249249
if (!PyBuffer_IsContiguous(&buffer, 'C')) {
250-
_PyArg_BadArgument("readinto", 0, "contiguous buffer", arg);
250+
_PyArg_BadArgument("readinto", "argument", "contiguous buffer", arg);
251251
goto exit;
252252
}
253253
return_value = _io__Buffered_readinto_impl(self, &buffer);
@@ -280,11 +280,11 @@ _io__Buffered_readinto1(buffered *self, PyObject *arg)
280280

281281
if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
282282
PyErr_Clear();
283-
_PyArg_BadArgument("readinto1", 0, "read-write bytes-like object", arg);
283+
_PyArg_BadArgument("readinto1", "argument", "read-write bytes-like object", arg);
284284
goto exit;
285285
}
286286
if (!PyBuffer_IsContiguous(&buffer, 'C')) {
287-
_PyArg_BadArgument("readinto1", 0, "contiguous buffer", arg);
287+
_PyArg_BadArgument("readinto1", "argument", "contiguous buffer", arg);
288288
goto exit;
289289
}
290290
return_value = _io__Buffered_readinto1_impl(self, &buffer);
@@ -538,7 +538,7 @@ _io_BufferedWriter_write(buffered *self, PyObject *arg)
538538
goto exit;
539539
}
540540
if (!PyBuffer_IsContiguous(&buffer, 'C')) {
541-
_PyArg_BadArgument("write", 0, "contiguous buffer", arg);
541+
_PyArg_BadArgument("write", "argument", "contiguous buffer", arg);
542542
goto exit;
543543
}
544544
return_value = _io_BufferedWriter_write_impl(self, &buffer);
@@ -672,4 +672,4 @@ _io_BufferedRandom___init__(PyObject *self, PyObject *args, PyObject *kwargs)
672672
exit:
673673
return return_value;
674674
}
675-
/*[clinic end generated code: output=b22b4aedd53c340a input=a9049054013a1b77]*/
675+
/*[clinic end generated code: output=7246104f6c7d3167 input=a9049054013a1b77]*/

Modules/_io/clinic/bytesio.c.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,11 +319,11 @@ _io_BytesIO_readinto(bytesio *self, PyObject *arg)
319319

320320
if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
321321
PyErr_Clear();
322-
_PyArg_BadArgument("readinto", 0, "read-write bytes-like object", arg);
322+
_PyArg_BadArgument("readinto", "argument", "read-write bytes-like object", arg);
323323
goto exit;
324324
}
325325
if (!PyBuffer_IsContiguous(&buffer, 'C')) {
326-
_PyArg_BadArgument("readinto", 0, "contiguous buffer", arg);
326+
_PyArg_BadArgument("readinto", "argument", "contiguous buffer", arg);
327327
goto exit;
328328
}
329329
return_value = _io_BytesIO_readinto_impl(self, &buffer);
@@ -515,4 +515,4 @@ _io_BytesIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
515515
exit:
516516
return return_value;
517517
}
518-
/*[clinic end generated code: output=22e8fb54874b6ee5 input=a9049054013a1b77]*/
518+
/*[clinic end generated code: output=4ec2506def9c8eb9 input=a9049054013a1b77]*/

Modules/_io/clinic/fileio.c.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ _io_FileIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
7070
}
7171
if (fastargs[1]) {
7272
if (!PyUnicode_Check(fastargs[1])) {
73-
_PyArg_BadArgument("FileIO", 2, "str", fastargs[1]);
73+
_PyArg_BadArgument("FileIO", "argument 'mode'", "str", fastargs[1]);
7474
goto exit;
7575
}
7676
Py_ssize_t mode_length;
@@ -200,11 +200,11 @@ _io_FileIO_readinto(fileio *self, PyObject *arg)
200200

201201
if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
202202
PyErr_Clear();
203-
_PyArg_BadArgument("readinto", 0, "read-write bytes-like object", arg);
203+
_PyArg_BadArgument("readinto", "argument", "read-write bytes-like object", arg);
204204
goto exit;
205205
}
206206
if (!PyBuffer_IsContiguous(&buffer, 'C')) {
207-
_PyArg_BadArgument("readinto", 0, "contiguous buffer", arg);
207+
_PyArg_BadArgument("readinto", "argument", "contiguous buffer", arg);
208208
goto exit;
209209
}
210210
return_value = _io_FileIO_readinto_impl(self, &buffer);
@@ -303,7 +303,7 @@ _io_FileIO_write(fileio *self, PyObject *arg)
303303
goto exit;
304304
}
305305
if (!PyBuffer_IsContiguous(&b, 'C')) {
306-
_PyArg_BadArgument("write", 0, "contiguous buffer", arg);
306+
_PyArg_BadArgument("write", "argument", "contiguous buffer", arg);
307307
goto exit;
308308
}
309309
return_value = _io_FileIO_write_impl(self, &b);
@@ -447,4 +447,4 @@ _io_FileIO_isatty(fileio *self, PyObject *Py_UNUSED(ignored))
447447
#ifndef _IO_FILEIO_TRUNCATE_METHODDEF
448448
#define _IO_FILEIO_TRUNCATE_METHODDEF
449449
#endif /* !defined(_IO_FILEIO_TRUNCATE_METHODDEF) */
450-
/*[clinic end generated code: output=7ee4f3ae584fc6d2 input=a9049054013a1b77]*/
450+
/*[clinic end generated code: output=a7e9cca3613660fb input=a9049054013a1b77]*/

Modules/_io/clinic/textio.c.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ _io_TextIOWrapper___init__(PyObject *self, PyObject *args, PyObject *kwargs)
229229
}
230230
}
231231
else {
232-
_PyArg_BadArgument("TextIOWrapper", 2, "str or None", fastargs[1]);
232+
_PyArg_BadArgument("TextIOWrapper", "argument 'encoding'", "str or None", fastargs[1]);
233233
goto exit;
234234
}
235235
if (!--noptargs) {
@@ -258,7 +258,7 @@ _io_TextIOWrapper___init__(PyObject *self, PyObject *args, PyObject *kwargs)
258258
}
259259
}
260260
else {
261-
_PyArg_BadArgument("TextIOWrapper", 4, "str or None", fastargs[3]);
261+
_PyArg_BadArgument("TextIOWrapper", "argument 'newline'", "str or None", fastargs[3]);
262262
goto exit;
263263
}
264264
if (!--noptargs) {
@@ -401,7 +401,7 @@ _io_TextIOWrapper_write(textio *self, PyObject *arg)
401401
PyObject *text;
402402

403403
if (!PyUnicode_Check(arg)) {
404-
_PyArg_BadArgument("write", 0, "str", arg);
404+
_PyArg_BadArgument("write", "argument", "str", arg);
405405
goto exit;
406406
}
407407
if (PyUnicode_READY(arg) == -1) {
@@ -701,4 +701,4 @@ _io_TextIOWrapper_close(textio *self, PyObject *Py_UNUSED(ignored))
701701
{
702702
return _io_TextIOWrapper_close_impl(self);
703703
}
704-
/*[clinic end generated code: output=b651e056e3000f88 input=a9049054013a1b77]*/
704+
/*[clinic end generated code: output=b1bae4f4cdf6019e input=a9049054013a1b77]*/

Modules/_io/clinic/winconsoleio.c.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ _io__WindowsConsoleIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
6969
}
7070
if (fastargs[1]) {
7171
if (!PyUnicode_Check(fastargs[1])) {
72-
_PyArg_BadArgument("_WindowsConsoleIO", 2, "str", fastargs[1]);
72+
_PyArg_BadArgument("_WindowsConsoleIO", "argument 'mode'", "str", fastargs[1]);
7373
goto exit;
7474
}
7575
Py_ssize_t mode_length;
@@ -200,11 +200,11 @@ _io__WindowsConsoleIO_readinto(winconsoleio *self, PyObject *arg)
200200

201201
if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
202202
PyErr_Clear();
203-
_PyArg_BadArgument("readinto", 0, "read-write bytes-like object", arg);
203+
_PyArg_BadArgument("readinto", "argument", "read-write bytes-like object", arg);
204204
goto exit;
205205
}
206206
if (!PyBuffer_IsContiguous(&buffer, 'C')) {
207-
_PyArg_BadArgument("readinto", 0, "contiguous buffer", arg);
207+
_PyArg_BadArgument("readinto", "argument", "contiguous buffer", arg);
208208
goto exit;
209209
}
210210
return_value = _io__WindowsConsoleIO_readinto_impl(self, &buffer);
@@ -313,7 +313,7 @@ _io__WindowsConsoleIO_write(winconsoleio *self, PyObject *arg)
313313
goto exit;
314314
}
315315
if (!PyBuffer_IsContiguous(&b, 'C')) {
316-
_PyArg_BadArgument("write", 0, "contiguous buffer", arg);
316+
_PyArg_BadArgument("write", "argument", "contiguous buffer", arg);
317317
goto exit;
318318
}
319319
return_value = _io__WindowsConsoleIO_write_impl(self, &b);
@@ -386,4 +386,4 @@ _io__WindowsConsoleIO_isatty(winconsoleio *self, PyObject *Py_UNUSED(ignored))
386386
#ifndef _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
387387
#define _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
388388
#endif /* !defined(_IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF) */
389-
/*[clinic end generated code: output=57bf2c09a42bd330 input=a9049054013a1b77]*/
389+
/*[clinic end generated code: output=f5b8860a658a001a input=a9049054013a1b77]*/

Modules/_multiprocessing/clinic/posixshmem.c.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ _posixshmem_shm_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
3535
goto exit;
3636
}
3737
if (!PyUnicode_Check(args[0])) {
38-
_PyArg_BadArgument("shm_open", 1, "str", args[0]);
38+
_PyArg_BadArgument("shm_open", "argument 'path'", "str", args[0]);
3939
goto exit;
4040
}
4141
if (PyUnicode_READY(args[0]) == -1) {
@@ -108,7 +108,7 @@ _posixshmem_shm_unlink(PyObject *module, PyObject *const *args, Py_ssize_t nargs
108108
goto exit;
109109
}
110110
if (!PyUnicode_Check(args[0])) {
111-
_PyArg_BadArgument("shm_unlink", 1, "str", args[0]);
111+
_PyArg_BadArgument("shm_unlink", "argument 'path'", "str", args[0]);
112112
goto exit;
113113
}
114114
if (PyUnicode_READY(args[0]) == -1) {
@@ -130,4 +130,4 @@ _posixshmem_shm_unlink(PyObject *module, PyObject *const *args, Py_ssize_t nargs
130130
#ifndef _POSIXSHMEM_SHM_UNLINK_METHODDEF
131131
#define _POSIXSHMEM_SHM_UNLINK_METHODDEF
132132
#endif /* !defined(_POSIXSHMEM_SHM_UNLINK_METHODDEF) */
133-
/*[clinic end generated code: output=be42e23c18677c0f input=a9049054013a1b77]*/
133+
/*[clinic end generated code: output=9132861c61d8c2d8 input=a9049054013a1b77]*/

0 commit comments

Comments
 (0)
0