Skip to content

Commit

Permalink
Issue python#27332: Fixed the type of the first argument of module-le…
Browse files Browse the repository at this point in the history
…vel functions

generated by Argument Clinic.  Patch by Petr Viktorin.
  • Loading branch information
serhiy-storchaka committed Jul 7, 2016
1 parent b8a2f51 commit 1a2b24f
Show file tree
Hide file tree
Showing 71 changed files with 1,814 additions and 1,835 deletions.
3 changes: 3 additions & 0 deletions Misc/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ C API
Tools/Demos
-----------

- Issue #27332: Fixed the type of the first argument of module-level functions
generated by Argument Clinic. Patch by Petr Viktorin.

- Issue #27418: Fixed Tools/importbench/importbench.py.


Expand Down
183 changes: 91 additions & 92 deletions Modules/_codecsmodule.c

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Modules/_cryptmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ results for a given *word*.
[clinic start generated code]*/

static PyObject *
crypt_crypt_impl(PyModuleDef *module, const char *word, const char *salt)
/*[clinic end generated code: output=995ad1e854d83069 input=0e8edec9c364352b]*/
crypt_crypt_impl(PyObject *module, const char *word, const char *salt)
/*[clinic end generated code: output=0512284a03d2803c input=0e8edec9c364352b]*/
{
/* On some platforms (AtheOS) crypt returns NULL for an invalid
salt. Return None in that case. XXX Maybe raise an exception? */
Expand Down
4 changes: 2 additions & 2 deletions Modules/_dbmmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,9 @@ Return a database object.
[clinic start generated code]*/

static PyObject *
dbmopen_impl(PyModuleDef *module, const char *filename, const char *flags,
dbmopen_impl(PyObject *module, const char *filename, const char *flags,
int mode)
/*[clinic end generated code: output=e8d4b36f25c733fd input=226334bade5764e6]*/
/*[clinic end generated code: output=5fade8cf16e0755f input=226334bade5764e6]*/
{
int iflags;

Expand Down
5 changes: 2 additions & 3 deletions Modules/_gdbmmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,9 +562,8 @@ when the database has to be created. It defaults to octal 0o666.
[clinic start generated code]*/

static PyObject *
dbmopen_impl(PyModuleDef *module, const char *name, const char *flags,
int mode)
/*[clinic end generated code: output=365b31415c03ccd4 input=55563cd60e51984a]*/
dbmopen_impl(PyObject *module, const char *name, const char *flags, int mode)
/*[clinic end generated code: output=31aa1bafdf5da688 input=55563cd60e51984a]*/
{
int iflags;

Expand Down
4 changes: 2 additions & 2 deletions Modules/_io/_iomodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,10 @@ opened in a binary mode.
[clinic start generated code]*/

static PyObject *
_io_open_impl(PyModuleDef *module, PyObject *file, const char *mode,
_io_open_impl(PyObject *module, PyObject *file, const char *mode,
int buffering, const char *encoding, const char *errors,
const char *newline, int closefd, PyObject *opener)
/*[clinic end generated code: output=7615d0d746eb14d2 input=f4e1ca75223987bc]*/
/*[clinic end generated code: output=aefafc4ce2b46dc0 input=f4e1ca75223987bc]*/
{
unsigned i;

Expand Down
6 changes: 3 additions & 3 deletions Modules/_io/clinic/_iomodule.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ PyDoc_STRVAR(_io_open__doc__,
{"open", (PyCFunction)_io_open, METH_VARARGS|METH_KEYWORDS, _io_open__doc__},

static PyObject *
_io_open_impl(PyModuleDef *module, PyObject *file, const char *mode,
_io_open_impl(PyObject *module, PyObject *file, const char *mode,
int buffering, const char *encoding, const char *errors,
const char *newline, int closefd, PyObject *opener);

static PyObject *
_io_open(PyModuleDef *module, PyObject *args, PyObject *kwargs)
_io_open(PyObject *module, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"file", "mode", "buffering", "encoding", "errors", "newline", "closefd", "opener", NULL};
Expand All @@ -156,4 +156,4 @@ _io_open(PyModuleDef *module, PyObject *args, PyObject *kwargs)
exit:
return return_value;
}
/*[clinic end generated code: output=97cdc09bf68a8064 input=a9049054013a1b77]*/
/*[clinic end generated code: output=bc2c003cb7daeafe input=a9049054013a1b77]*/
12 changes: 6 additions & 6 deletions Modules/_lzmamodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1342,8 +1342,8 @@ Always returns True for CHECK_NONE and CHECK_CRC32.
[clinic start generated code]*/

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

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

static PyObject *
_lzma__decode_filter_properties_impl(PyModuleDef *module, lzma_vli filter_id,
_lzma__decode_filter_properties_impl(PyObject *module, lzma_vli filter_id,
Py_buffer *encoded_props)
/*[clinic end generated code: output=af248f570746668b input=246410800782160c]*/
/*[clinic end generated code: output=714fd2ef565d5c60 input=246410800782160c]*/
{
lzma_filter filter;
lzma_ret lzret;
Expand Down
4 changes: 2 additions & 2 deletions Modules/_opcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Compute the stack effect of the opcode.
[clinic start generated code]*/

static int
_opcode_stack_effect_impl(PyModuleDef *module, int opcode, PyObject *oparg)
/*[clinic end generated code: output=1fcafd5596c6b050 input=2d0a9ee53c0418f5]*/
_opcode_stack_effect_impl(PyObject *module, int opcode, PyObject *oparg)
/*[clinic end generated code: output=ad39467fa3ad22ce input=2d0a9ee53c0418f5]*/
{
int effect;
int oparg_int = 0;
Expand Down
16 changes: 8 additions & 8 deletions Modules/_pickle.c
Original file line number Diff line number Diff line change
Expand Up @@ -6961,9 +6961,9 @@ to map the new Python 3 names to the old module names used in Python
[clinic start generated code]*/

static PyObject *
_pickle_dump_impl(PyModuleDef *module, PyObject *obj, PyObject *file,
_pickle_dump_impl(PyObject *module, PyObject *obj, PyObject *file,
PyObject *protocol, int fix_imports)
/*[clinic end generated code: output=0de7dff89c406816 input=830f8a64cef6f042]*/
/*[clinic end generated code: output=a4774d5fde7d34de input=830f8a64cef6f042]*/
{
PicklerObject *pickler = _Pickler_New();

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

static PyObject *
_pickle_dumps_impl(PyModuleDef *module, PyObject *obj, PyObject *protocol,
_pickle_dumps_impl(PyObject *module, PyObject *obj, PyObject *protocol,
int fix_imports)
/*[clinic end generated code: output=daa380db56fe07b9 input=293dbeda181580b7]*/
/*[clinic end generated code: output=d75d5cda456fd261 input=293dbeda181580b7]*/
{
PyObject *result;
PicklerObject *pickler = _Pickler_New();
Expand Down Expand Up @@ -7076,9 +7076,9 @@ string instances as bytes objects.
[clinic start generated code]*/

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

static PyObject *
_pickle_loads_impl(PyModuleDef *module, PyObject *data, int fix_imports,
_pickle_loads_impl(PyObject *module, PyObject *data, int fix_imports,
const char *encoding, const char *errors)
/*[clinic end generated code: output=61e9cdb01e36a736 input=70605948a719feb9]*/
/*[clinic end generated code: output=1e7cb2343f2c440f input=70605948a719feb9]*/
{
PyObject *result;
UnpicklerObject *unpickler = _Unpickler_New();
Expand Down
12 changes: 6 additions & 6 deletions Modules/_sre.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ _sre.getcodesize -> int
[clinic start generated code]*/

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

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

static PyObject *
_sre_compile_impl(PyModuleDef *module, PyObject *pattern, int flags,
_sre_compile_impl(PyObject *module, PyObject *pattern, int flags,
PyObject *code, Py_ssize_t groups, PyObject *groupindex,
PyObject *indexgroup)
/*[clinic end generated code: output=3004b293730bf309 input=7d059ec8ae1edb85]*/
/*[clinic end generated code: output=ef9c2b3693776404 input=7d059ec8ae1edb85]*/
{
/* "compile" pattern descriptor to pattern object */

Expand Down
44 changes: 22 additions & 22 deletions Modules/_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1321,8 +1321,8 @@ _ssl._test_decode_cert
[clinic start generated code]*/

static PyObject *
_ssl__test_decode_cert_impl(PyModuleDef *module, PyObject *path)
/*[clinic end generated code: output=679e01db282804e9 input=cdeaaf02d4346628]*/
_ssl__test_decode_cert_impl(PyObject *module, PyObject *path)
/*[clinic end generated code: output=96becb9abb23c091 input=cdeaaf02d4346628]*/
{
PyObject *retval = NULL;
X509 *x=NULL;
Expand Down Expand Up @@ -3832,8 +3832,8 @@ string. See RFC 1750.
[clinic start generated code]*/

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

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

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

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

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

static PyObject *
_ssl_get_default_verify_paths_impl(PyModuleDef *module)
/*[clinic end generated code: output=5a2820ce7e3304d3 input=5210c953d98c3eb5]*/
_ssl_get_default_verify_paths_impl(PyObject *module)
/*[clinic end generated code: output=e5b62a466271928b input=5210c953d98c3eb5]*/
{
PyObject *ofile_env = NULL;
PyObject *ofile = NULL;
Expand Down Expand Up @@ -4049,8 +4049,8 @@ long name are also matched.
[clinic start generated code]*/

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

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

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

static PyObject *
_ssl_enum_crls_impl(PyModuleDef *module, const char *store_name)
/*[clinic end generated code: output=763490a2aa1c50d5 input=a1f1d7629f1c5d3d]*/
_ssl_enum_crls_impl(PyObject *module, const char *store_name)
/*[clinic end generated code: output=bce467f60ccd03b6 input=a1f1d7629f1c5d3d]*/
{
HCERTSTORE hStore = NULL;
PCCRL_CONTEXT pCrlCtx = NULL;
Expand Down
16 changes: 8 additions & 8 deletions Modules/_tkinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -3175,8 +3175,8 @@ _tkinter._flatten
[clinic start generated code]*/

static PyObject *
_tkinter__flatten(PyModuleDef *module, PyObject *item)
/*[clinic end generated code: output=9505049ec74c3480 input=6b9c12260aa1157f]*/
_tkinter__flatten(PyObject *module, PyObject *item)
/*[clinic end generated code: output=cad02a3f97f29862 input=6b9c12260aa1157f]*/
{
FlattenContext context;

Expand Down Expand Up @@ -3220,11 +3220,11 @@ _tkinter.create
[clinic start generated code]*/

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

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

static int
_tkinter_getbusywaitinterval_impl(PyModuleDef *module)
/*[clinic end generated code: output=9d09eee026e96971 input=a695878d2d576a84]*/
_tkinter_getbusywaitinterval_impl(PyObject *module)
/*[clinic end generated code: output=23b72d552001f5c7 input=a695878d2d576a84]*/
{
return Tkinter_busywaitinterval;
}
Expand Down
4 changes: 2 additions & 2 deletions Modules/_weakref.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Return the number of weak references to 'object'.
[clinic start generated code]*/

static Py_ssize_t
_weakref_getweakrefcount_impl(PyModuleDef *module, PyObject *object)
/*[clinic end generated code: output=6a6ad0b98285e468 input=cedb69711b6a2507]*/
_weakref_getweakrefcount_impl(PyObject *module, PyObject *object)
/*[clinic end generated code: output=301806d59558ff3e input=cedb69711b6a2507]*/
{
PyWeakReference **list;

Expand Down
Loading

0 comments on commit 1a2b24f

Please sign in to comment.