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

Commit 1a2b24f

Browse files
Issue python#27332: Fixed the type of the first argument of module-level functions
generated by Argument Clinic. Patch by Petr Viktorin.
1 parent b8a2f51 commit 1a2b24f

Some content is hidden

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

71 files changed

+1814
-1835
lines changed

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ C API
8080
Tools/Demos
8181
-----------
8282

83+
- Issue #27332: Fixed the type of the first argument of module-level functions
84+
generated by Argument Clinic. Patch by Petr Viktorin.
85+
8386
- Issue #27418: Fixed Tools/importbench/importbench.py.
8487

8588

Modules/_codecsmodule.c

Lines changed: 91 additions & 92 deletions
Large diffs are not rendered by default.

Modules/_cryptmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ results for a given *word*.
3131
[clinic start generated code]*/
3232

3333
static PyObject *
34-
crypt_crypt_impl(PyModuleDef *module, const char *word, const char *salt)
35-
/*[clinic end generated code: output=995ad1e854d83069 input=0e8edec9c364352b]*/
34+
crypt_crypt_impl(PyObject *module, const char *word, const char *salt)
35+
/*[clinic end generated code: output=0512284a03d2803c input=0e8edec9c364352b]*/
3636
{
3737
/* On some platforms (AtheOS) crypt returns NULL for an invalid
3838
salt. Return None in that case. XXX Maybe raise an exception? */

Modules/_dbmmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,9 @@ Return a database object.
430430
[clinic start generated code]*/
431431

432432
static PyObject *
433-
dbmopen_impl(PyModuleDef *module, const char *filename, const char *flags,
433+
dbmopen_impl(PyObject *module, const char *filename, const char *flags,
434434
int mode)
435-
/*[clinic end generated code: output=e8d4b36f25c733fd input=226334bade5764e6]*/
435+
/*[clinic end generated code: output=5fade8cf16e0755f input=226334bade5764e6]*/
436436
{
437437
int iflags;
438438

Modules/_gdbmmodule.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -562,9 +562,8 @@ when the database has to be created. It defaults to octal 0o666.
562562
[clinic start generated code]*/
563563

564564
static PyObject *
565-
dbmopen_impl(PyModuleDef *module, const char *name, const char *flags,
566-
int mode)
567-
/*[clinic end generated code: output=365b31415c03ccd4 input=55563cd60e51984a]*/
565+
dbmopen_impl(PyObject *module, const char *name, const char *flags, int mode)
566+
/*[clinic end generated code: output=31aa1bafdf5da688 input=55563cd60e51984a]*/
568567
{
569568
int iflags;
570569

Modules/_io/_iomodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,10 @@ opened in a binary mode.
227227
[clinic start generated code]*/
228228

229229
static PyObject *
230-
_io_open_impl(PyModuleDef *module, PyObject *file, const char *mode,
230+
_io_open_impl(PyObject *module, PyObject *file, const char *mode,
231231
int buffering, const char *encoding, const char *errors,
232232
const char *newline, int closefd, PyObject *opener)
233-
/*[clinic end generated code: output=7615d0d746eb14d2 input=f4e1ca75223987bc]*/
233+
/*[clinic end generated code: output=aefafc4ce2b46dc0 input=f4e1ca75223987bc]*/
234234
{
235235
unsigned i;
236236

Modules/_io/clinic/_iomodule.c.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,12 @@ PyDoc_STRVAR(_io_open__doc__,
130130
{"open", (PyCFunction)_io_open, METH_VARARGS|METH_KEYWORDS, _io_open__doc__},
131131

132132
static PyObject *
133-
_io_open_impl(PyModuleDef *module, PyObject *file, const char *mode,
133+
_io_open_impl(PyObject *module, PyObject *file, const char *mode,
134134
int buffering, const char *encoding, const char *errors,
135135
const char *newline, int closefd, PyObject *opener);
136136

137137
static PyObject *
138-
_io_open(PyModuleDef *module, PyObject *args, PyObject *kwargs)
138+
_io_open(PyObject *module, PyObject *args, PyObject *kwargs)
139139
{
140140
PyObject *return_value = NULL;
141141
static char *_keywords[] = {"file", "mode", "buffering", "encoding", "errors", "newline", "closefd", "opener", NULL};
@@ -156,4 +156,4 @@ _io_open(PyModuleDef *module, PyObject *args, PyObject *kwargs)
156156
exit:
157157
return return_value;
158158
}
159-
/*[clinic end generated code: output=97cdc09bf68a8064 input=a9049054013a1b77]*/
159+
/*[clinic end generated code: output=bc2c003cb7daeafe input=a9049054013a1b77]*/

Modules/_lzmamodule.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,8 +1342,8 @@ Always returns True for CHECK_NONE and CHECK_CRC32.
13421342
[clinic start generated code]*/
13431343

13441344
static PyObject *
1345-
_lzma_is_check_supported_impl(PyModuleDef *module, int check_id)
1346-
/*[clinic end generated code: output=bb828e90e00ad96e input=5518297b97b2318f]*/
1345+
_lzma_is_check_supported_impl(PyObject *module, int check_id)
1346+
/*[clinic end generated code: output=e4f14ba3ce2ad0a5 input=5518297b97b2318f]*/
13471347
{
13481348
return PyBool_FromLong(lzma_check_is_supported(check_id));
13491349
}
@@ -1360,8 +1360,8 @@ The result does not include the filter ID itself, only the options.
13601360
[clinic start generated code]*/
13611361

13621362
static PyObject *
1363-
_lzma__encode_filter_properties_impl(PyModuleDef *module, lzma_filter filter)
1364-
/*[clinic end generated code: output=b5fe690acd6b61d1 input=d4c64f1b557c77d4]*/
1363+
_lzma__encode_filter_properties_impl(PyObject *module, lzma_filter filter)
1364+
/*[clinic end generated code: output=5c93c8e14e7be5a8 input=d4c64f1b557c77d4]*/
13651365
{
13661366
lzma_ret lzret;
13671367
uint32_t encoded_size;
@@ -1400,9 +1400,9 @@ The result does not include the filter ID itself, only the options.
14001400
[clinic start generated code]*/
14011401

14021402
static PyObject *
1403-
_lzma__decode_filter_properties_impl(PyModuleDef *module, lzma_vli filter_id,
1403+
_lzma__decode_filter_properties_impl(PyObject *module, lzma_vli filter_id,
14041404
Py_buffer *encoded_props)
1405-
/*[clinic end generated code: output=af248f570746668b input=246410800782160c]*/
1405+
/*[clinic end generated code: output=714fd2ef565d5c60 input=246410800782160c]*/
14061406
{
14071407
lzma_filter filter;
14081408
lzma_ret lzret;

Modules/_opcode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ Compute the stack effect of the opcode.
2020
[clinic start generated code]*/
2121

2222
static int
23-
_opcode_stack_effect_impl(PyModuleDef *module, int opcode, PyObject *oparg)
24-
/*[clinic end generated code: output=1fcafd5596c6b050 input=2d0a9ee53c0418f5]*/
23+
_opcode_stack_effect_impl(PyObject *module, int opcode, PyObject *oparg)
24+
/*[clinic end generated code: output=ad39467fa3ad22ce input=2d0a9ee53c0418f5]*/
2525
{
2626
int effect;
2727
int oparg_int = 0;

Modules/_pickle.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6961,9 +6961,9 @@ to map the new Python 3 names to the old module names used in Python
69616961
[clinic start generated code]*/
69626962

69636963
static PyObject *
6964-
_pickle_dump_impl(PyModuleDef *module, PyObject *obj, PyObject *file,
6964+
_pickle_dump_impl(PyObject *module, PyObject *obj, PyObject *file,
69656965
PyObject *protocol, int fix_imports)
6966-
/*[clinic end generated code: output=0de7dff89c406816 input=830f8a64cef6f042]*/
6966+
/*[clinic end generated code: output=a4774d5fde7d34de input=830f8a64cef6f042]*/
69676967
{
69686968
PicklerObject *pickler = _Pickler_New();
69696969

@@ -7015,9 +7015,9 @@ Python 2, so that the pickle data stream is readable with Python 2.
70157015
[clinic start generated code]*/
70167016

70177017
static PyObject *
7018-
_pickle_dumps_impl(PyModuleDef *module, PyObject *obj, PyObject *protocol,
7018+
_pickle_dumps_impl(PyObject *module, PyObject *obj, PyObject *protocol,
70197019
int fix_imports)
7020-
/*[clinic end generated code: output=daa380db56fe07b9 input=293dbeda181580b7]*/
7020+
/*[clinic end generated code: output=d75d5cda456fd261 input=293dbeda181580b7]*/
70217021
{
70227022
PyObject *result;
70237023
PicklerObject *pickler = _Pickler_New();
@@ -7076,9 +7076,9 @@ string instances as bytes objects.
70767076
[clinic start generated code]*/
70777077

70787078
static PyObject *
7079-
_pickle_load_impl(PyModuleDef *module, PyObject *file, int fix_imports,
7079+
_pickle_load_impl(PyObject *module, PyObject *file, int fix_imports,
70807080
const char *encoding, const char *errors)
7081-
/*[clinic end generated code: output=798f1c57cb2b4eb1 input=01b44dd3fc07afa7]*/
7081+
/*[clinic end generated code: output=69e298160285199e input=01b44dd3fc07afa7]*/
70827082
{
70837083
PyObject *result;
70847084
UnpicklerObject *unpickler = _Unpickler_New();
@@ -7130,9 +7130,9 @@ string instances as bytes objects.
71307130
[clinic start generated code]*/
71317131

71327132
static PyObject *
7133-
_pickle_loads_impl(PyModuleDef *module, PyObject *data, int fix_imports,
7133+
_pickle_loads_impl(PyObject *module, PyObject *data, int fix_imports,
71347134
const char *encoding, const char *errors)
7135-
/*[clinic end generated code: output=61e9cdb01e36a736 input=70605948a719feb9]*/
7135+
/*[clinic end generated code: output=1e7cb2343f2c440f input=70605948a719feb9]*/
71367136
{
71377137
PyObject *result;
71387138
UnpicklerObject *unpickler = _Unpickler_New();

Modules/_sre.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,8 @@ _sre.getcodesize -> int
278278
[clinic start generated code]*/
279279

280280
static int
281-
_sre_getcodesize_impl(PyModuleDef *module)
282-
/*[clinic end generated code: output=794f1f98ef4883e5 input=bd6f6ecf4916bb2b]*/
281+
_sre_getcodesize_impl(PyObject *module)
282+
/*[clinic end generated code: output=e0db7ce34a6dd7b1 input=bd6f6ecf4916bb2b]*/
283283
{
284284
return sizeof(SRE_CODE);
285285
}
@@ -294,8 +294,8 @@ _sre.getlower -> int
294294
[clinic start generated code]*/
295295

296296
static int
297-
_sre_getlower_impl(PyModuleDef *module, int character, int flags)
298-
/*[clinic end generated code: output=5fc3616ae2a4c306 input=087d2f1c44bbca6f]*/
297+
_sre_getlower_impl(PyObject *module, int character, int flags)
298+
/*[clinic end generated code: output=47eebc4c1214feb5 input=087d2f1c44bbca6f]*/
299299
{
300300
if (flags & SRE_FLAG_LOCALE)
301301
return sre_lower_locale(character);
@@ -1454,10 +1454,10 @@ _sre.compile
14541454
[clinic start generated code]*/
14551455

14561456
static PyObject *
1457-
_sre_compile_impl(PyModuleDef *module, PyObject *pattern, int flags,
1457+
_sre_compile_impl(PyObject *module, PyObject *pattern, int flags,
14581458
PyObject *code, Py_ssize_t groups, PyObject *groupindex,
14591459
PyObject *indexgroup)
1460-
/*[clinic end generated code: output=3004b293730bf309 input=7d059ec8ae1edb85]*/
1460+
/*[clinic end generated code: output=ef9c2b3693776404 input=7d059ec8ae1edb85]*/
14611461
{
14621462
/* "compile" pattern descriptor to pattern object */
14631463

Modules/_ssl.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,8 +1321,8 @@ _ssl._test_decode_cert
13211321
[clinic start generated code]*/
13221322

13231323
static PyObject *
1324-
_ssl__test_decode_cert_impl(PyModuleDef *module, PyObject *path)
1325-
/*[clinic end generated code: output=679e01db282804e9 input=cdeaaf02d4346628]*/
1324+
_ssl__test_decode_cert_impl(PyObject *module, PyObject *path)
1325+
/*[clinic end generated code: output=96becb9abb23c091 input=cdeaaf02d4346628]*/
13261326
{
13271327
PyObject *retval = NULL;
13281328
X509 *x=NULL;
@@ -3832,8 +3832,8 @@ string. See RFC 1750.
38323832
[clinic start generated code]*/
38333833

38343834
static PyObject *
3835-
_ssl_RAND_add_impl(PyModuleDef *module, Py_buffer *view, double entropy)
3836-
/*[clinic end generated code: output=0f8d5c8cce328958 input=580c85e6a3a4fe29]*/
3835+
_ssl_RAND_add_impl(PyObject *module, Py_buffer *view, double entropy)
3836+
/*[clinic end generated code: output=e6dd48df9c9024e9 input=580c85e6a3a4fe29]*/
38373837
{
38383838
const char *buf;
38393839
Py_ssize_t len, written;
@@ -3898,8 +3898,8 @@ Generate n cryptographically strong pseudo-random bytes.
38983898
[clinic start generated code]*/
38993899

39003900
static PyObject *
3901-
_ssl_RAND_bytes_impl(PyModuleDef *module, int n)
3902-
/*[clinic end generated code: output=7d8741bdc1d435f3 input=678ddf2872dfebfc]*/
3901+
_ssl_RAND_bytes_impl(PyObject *module, int n)
3902+
/*[clinic end generated code: output=977da635e4838bc7 input=678ddf2872dfebfc]*/
39033903
{
39043904
return PySSL_RAND(n, 0);
39053905
}
@@ -3916,8 +3916,8 @@ if the bytes generated are cryptographically strong.
39163916
[clinic start generated code]*/
39173917

39183918
static PyObject *
3919-
_ssl_RAND_pseudo_bytes_impl(PyModuleDef *module, int n)
3920-
/*[clinic end generated code: output=dd673813107f3875 input=58312bd53f9bbdd0]*/
3919+
_ssl_RAND_pseudo_bytes_impl(PyObject *module, int n)
3920+
/*[clinic end generated code: output=b1509e937000e52d input=58312bd53f9bbdd0]*/
39213921
{
39223922
return PySSL_RAND(n, 1);
39233923
}
@@ -3932,8 +3932,8 @@ using the ssl() function.
39323932
[clinic start generated code]*/
39333933

39343934
static PyObject *
3935-
_ssl_RAND_status_impl(PyModuleDef *module)
3936-
/*[clinic end generated code: output=7f7ef57bc7dd1d1c input=8a774b02d1dc81f3]*/
3935+
_ssl_RAND_status_impl(PyObject *module)
3936+
/*[clinic end generated code: output=7e0aaa2d39fdc1ad input=8a774b02d1dc81f3]*/
39373937
{
39383938
return PyLong_FromLong(RAND_status());
39393939
}
@@ -3951,8 +3951,8 @@ fails or if it does not provide enough data to seed PRNG.
39513951
[clinic start generated code]*/
39523952

39533953
static PyObject *
3954-
_ssl_RAND_egd_impl(PyModuleDef *module, PyObject *path)
3955-
/*[clinic end generated code: output=8e728e501e28541b input=1aeb7eb948312195]*/
3954+
_ssl_RAND_egd_impl(PyObject *module, PyObject *path)
3955+
/*[clinic end generated code: output=02a67c7c367f52fa input=1aeb7eb948312195]*/
39563956
{
39573957
int bytes = RAND_egd(PyBytes_AsString(path));
39583958
Py_DECREF(path);
@@ -3977,8 +3977,8 @@ The values are 'cert_file_env', 'cert_file', 'cert_dir_env', 'cert_dir'.
39773977
[clinic start generated code]*/
39783978

39793979
static PyObject *
3980-
_ssl_get_default_verify_paths_impl(PyModuleDef *module)
3981-
/*[clinic end generated code: output=5a2820ce7e3304d3 input=5210c953d98c3eb5]*/
3980+
_ssl_get_default_verify_paths_impl(PyObject *module)
3981+
/*[clinic end generated code: output=e5b62a466271928b input=5210c953d98c3eb5]*/
39823982
{
39833983
PyObject *ofile_env = NULL;
39843984
PyObject *ofile = NULL;
@@ -4049,8 +4049,8 @@ long name are also matched.
40494049
[clinic start generated code]*/
40504050

40514051
static PyObject *
4052-
_ssl_txt2obj_impl(PyModuleDef *module, const char *txt, int name)
4053-
/*[clinic end generated code: output=2ae2c30531b8809f input=1c1e7d0aa7c48602]*/
4052+
_ssl_txt2obj_impl(PyObject *module, const char *txt, int name)
4053+
/*[clinic end generated code: output=c38e3991347079c1 input=1c1e7d0aa7c48602]*/
40544054
{
40554055
PyObject *result = NULL;
40564056
ASN1_OBJECT *obj;
@@ -4074,8 +4074,8 @@ Lookup NID, short name, long name and OID of an ASN1_OBJECT by NID.
40744074
[clinic start generated code]*/
40754075

40764076
static PyObject *
4077-
_ssl_nid2obj_impl(PyModuleDef *module, int nid)
4078-
/*[clinic end generated code: output=8db1df89e44badb8 input=51787a3bee7d8f98]*/
4077+
_ssl_nid2obj_impl(PyObject *module, int nid)
4078+
/*[clinic end generated code: output=4a98ab691cd4f84a input=51787a3bee7d8f98]*/
40794079
{
40804080
PyObject *result = NULL;
40814081
ASN1_OBJECT *obj;
@@ -4193,8 +4193,8 @@ a set of OIDs or the boolean True.
41934193
[clinic start generated code]*/
41944194

41954195
static PyObject *
4196-
_ssl_enum_certificates_impl(PyModuleDef *module, const char *store_name)
4197-
/*[clinic end generated code: output=cc4ebc10b8adacfc input=915f60d70461ea4e]*/
4196+
_ssl_enum_certificates_impl(PyObject *module, const char *store_name)
4197+
/*[clinic end generated code: output=5134dc8bb3a3c893 input=915f60d70461ea4e]*/
41984198
{
41994199
HCERTSTORE hStore = NULL;
42004200
PCCERT_CONTEXT pCertCtx = NULL;
@@ -4281,8 +4281,8 @@ X509_ASN_ENCODING or PKCS_7_ASN_ENCODING.
42814281
[clinic start generated code]*/
42824282

42834283
static PyObject *
4284-
_ssl_enum_crls_impl(PyModuleDef *module, const char *store_name)
4285-
/*[clinic end generated code: output=763490a2aa1c50d5 input=a1f1d7629f1c5d3d]*/
4284+
_ssl_enum_crls_impl(PyObject *module, const char *store_name)
4285+
/*[clinic end generated code: output=bce467f60ccd03b6 input=a1f1d7629f1c5d3d]*/
42864286
{
42874287
HCERTSTORE hStore = NULL;
42884288
PCCRL_CONTEXT pCrlCtx = NULL;

Modules/_tkinter.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3175,8 +3175,8 @@ _tkinter._flatten
31753175
[clinic start generated code]*/
31763176

31773177
static PyObject *
3178-
_tkinter__flatten(PyModuleDef *module, PyObject *item)
3179-
/*[clinic end generated code: output=9505049ec74c3480 input=6b9c12260aa1157f]*/
3178+
_tkinter__flatten(PyObject *module, PyObject *item)
3179+
/*[clinic end generated code: output=cad02a3f97f29862 input=6b9c12260aa1157f]*/
31803180
{
31813181
FlattenContext context;
31823182

@@ -3220,11 +3220,11 @@ _tkinter.create
32203220
[clinic start generated code]*/
32213221

32223222
static PyObject *
3223-
_tkinter_create_impl(PyModuleDef *module, const char *screenName,
3223+
_tkinter_create_impl(PyObject *module, const char *screenName,
32243224
const char *baseName, const char *className,
32253225
int interactive, int wantobjects, int wantTk, int sync,
32263226
const char *use)
3227-
/*[clinic end generated code: output=b8847800fc3b27eb input=0d522aad1cb0ca0e]*/
3227+
/*[clinic end generated code: output=e3315607648e6bb4 input=0d522aad1cb0ca0e]*/
32283228
{
32293229
/* XXX baseName is not used anymore;
32303230
* try getting rid of it. */
@@ -3250,8 +3250,8 @@ It should be set to a divisor of the maximum time between frames in an animation
32503250
[clinic start generated code]*/
32513251

32523252
static PyObject *
3253-
_tkinter_setbusywaitinterval_impl(PyModuleDef *module, int new_val)
3254-
/*[clinic end generated code: output=0b9d7ef7940461ea input=deca1d6f9e6dae47]*/
3253+
_tkinter_setbusywaitinterval_impl(PyObject *module, int new_val)
3254+
/*[clinic end generated code: output=42bf7757dc2d0ab6 input=deca1d6f9e6dae47]*/
32553255
{
32563256
if (new_val < 0) {
32573257
PyErr_SetString(PyExc_ValueError,
@@ -3269,8 +3269,8 @@ Return the current busy-wait interval between successive calls to Tcl_DoOneEvent
32693269
[clinic start generated code]*/
32703270

32713271
static int
3272-
_tkinter_getbusywaitinterval_impl(PyModuleDef *module)
3273-
/*[clinic end generated code: output=9d09eee026e96971 input=a695878d2d576a84]*/
3272+
_tkinter_getbusywaitinterval_impl(PyObject *module)
3273+
/*[clinic end generated code: output=23b72d552001f5c7 input=a695878d2d576a84]*/
32743274
{
32753275
return Tkinter_busywaitinterval;
32763276
}

Modules/_weakref.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ Return the number of weak references to 'object'.
2222
[clinic start generated code]*/
2323

2424
static Py_ssize_t
25-
_weakref_getweakrefcount_impl(PyModuleDef *module, PyObject *object)
26-
/*[clinic end generated code: output=6a6ad0b98285e468 input=cedb69711b6a2507]*/
25+
_weakref_getweakrefcount_impl(PyObject *module, PyObject *object)
26+
/*[clinic end generated code: output=301806d59558ff3e input=cedb69711b6a2507]*/
2727
{
2828
PyWeakReference **list;
2929

0 commit comments

Comments
 (0)