bpo-31926: fix missing *_METHODDEF statements by argument clinic (#4230) · python/cpython@4f57409 · GitHub
Skip to content

Commit 4f57409

Browse files
taleinatserhiy-storchaka
authored andcommitted
bpo-31926: fix missing *_METHODDEF statements by argument clinic (#4230)
When a single .c file contains several functions and/or methods with the same name, a safety _METHODDEF #define statement is generated only for one of them. This fixes the bug by using the full name of the function to avoid duplicates rather than just the name.
1 parent 700d2e4 commit 4f57409

4 files changed

Lines changed: 9 additions & 7 deletions

File tree

Lines changed: 2 additions & 0 deletions

Modules/clinic/zlibmodule.c.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,4 +467,8 @@ zlib_crc32(PyObject *module, PyObject **args, Py_ssize_t nargs)
467467
#ifndef ZLIB_COMPRESS_COPY_METHODDEF
468468
#define ZLIB_COMPRESS_COPY_METHODDEF
469469
#endif /* !defined(ZLIB_COMPRESS_COPY_METHODDEF) */
470-
/*[clinic end generated code: output=e0184313eb431e95 input=a9049054013a1b77]*/
470+
471+
#ifndef ZLIB_DECOMPRESS_COPY_METHODDEF
472+
#define ZLIB_DECOMPRESS_COPY_METHODDEF
473+
#endif /* !defined(ZLIB_DECOMPRESS_COPY_METHODDEF) */
474+
/*[clinic end generated code: output=6378d429f0819817 input=a9049054013a1b77]*/

Modules/zlibmodule.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,19 +1138,15 @@ static PyMethodDef comp_methods[] =
11381138
{
11391139
ZLIB_COMPRESS_COMPRESS_METHODDEF
11401140
ZLIB_COMPRESS_FLUSH_METHODDEF
1141-
#ifdef HAVE_ZLIB_COPY
11421141
ZLIB_COMPRESS_COPY_METHODDEF
1143-
#endif
11441142
{NULL, NULL}
11451143
};
11461144

11471145
static PyMethodDef Decomp_methods[] =
11481146
{
11491147
ZLIB_DECOMPRESS_DECOMPRESS_METHODDEF
11501148
ZLIB_DECOMPRESS_FLUSH_METHODDEF
1151-
#ifdef HAVE_ZLIB_COPY
11521149
ZLIB_DECOMPRESS_COPY_METHODDEF
1153-
#endif
11541150
{NULL, NULL}
11551151
};
11561152

Tools/clinic/clinic.py

Lines changed: 2 additions & 2 deletions

0 commit comments

Comments
 (0)