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

4 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,2 @@

1+

Fixed Argument Clinic sometimes causing compilation errors when there was

2+

more than one function and/or method in a .c file with the same name.

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]*/

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
Original file line numberDiff line numberDiff line change

@@ -957,8 +957,8 @@ def insert_keywords(s):

957957

cpp_if = "#if " + conditional

958958

cpp_endif = "#endif /* " + conditional + " */"

959959
960-

if methoddef_define and f.name not in clinic.ifndef_symbols:

961-

clinic.ifndef_symbols.add(f.name)

960+

if methoddef_define and f.full_name not in clinic.ifndef_symbols:

961+

clinic.ifndef_symbols.add(f.full_name)

962962

methoddef_ifndef = normalize_snippet("""

963963

#ifndef {methoddef_name}

964964

#define {methoddef_name}