Skip to content

Commit 0759f84

Browse files
committed
Issue #23500: Argument Clinic is now smarter about generating the "#ifndef"
(empty) definition of the methoddef macro: it's only generated once, even if Argument Clinic processes the same symbol multiple times, and it's emitted at the end of all processing rather than immediately after the first use.
1 parent 5cf2b72 commit 0759f84

File tree

5 files changed

+111
-92
lines changed

5 files changed

+111
-92
lines changed

Misc/NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,11 @@ Tests
268268
Tools/Demos
269269
-----------
270270

271+
- Issue #23500: Argument Clinic is now smarter about generating the "#ifndef"
272+
(empty) definition of the methoddef macro: it's only generated once, even
273+
if Argument Clinic processes the same symbol multiple times, and it's emitted
274+
at the end of all processing rather than immediately after the first use.
275+
271276
- Issue #22826: The result of open() in Tools/freeze/bkfile.py is now better
272277
compatible with regular files (in particular it now supports the context
273278
management protocol).

Modules/clinic/spwdmodule.c.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ spwd_getspnam(PyModuleDef *module, PyObject *args)
3636

3737
#endif /* defined(HAVE_GETSPNAM) */
3838

39-
#ifndef SPWD_GETSPNAM_METHODDEF
40-
#define SPWD_GETSPNAM_METHODDEF
41-
#endif /* !defined(SPWD_GETSPNAM_METHODDEF) */
42-
4339
#if defined(HAVE_GETSPENT)
4440

4541
PyDoc_STRVAR(spwd_getspall__doc__,
@@ -64,7 +60,11 @@ spwd_getspall(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
6460

6561
#endif /* defined(HAVE_GETSPENT) */
6662

63+
#ifndef SPWD_GETSPNAM_METHODDEF
64+
#define SPWD_GETSPNAM_METHODDEF
65+
#endif /* !defined(SPWD_GETSPNAM_METHODDEF) */
66+
6767
#ifndef SPWD_GETSPALL_METHODDEF
6868
#define SPWD_GETSPALL_METHODDEF
6969
#endif /* !defined(SPWD_GETSPALL_METHODDEF) */
70-
/*[clinic end generated code: output=41fec4a15b0cd2a0 input=a9049054013a1b77]*/
70+
/*[clinic end generated code: output=ab16125c5e5f2b1b input=a9049054013a1b77]*/

Modules/clinic/zlibmodule.c.h

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,6 @@ zlib_Compress_copy(compobject *self, PyObject *Py_UNUSED(ignored))
314314

315315
#endif /* defined(HAVE_ZLIB_COPY) */
316316

317-
#ifndef ZLIB_COMPRESS_COPY_METHODDEF
318-
#define ZLIB_COMPRESS_COPY_METHODDEF
319-
#endif /* !defined(ZLIB_COMPRESS_COPY_METHODDEF) */
320-
321317
#if defined(HAVE_ZLIB_COPY)
322318

323319
PyDoc_STRVAR(zlib_Decompress_copy__doc__,
@@ -340,10 +336,6 @@ zlib_Decompress_copy(compobject *self, PyObject *Py_UNUSED(ignored))
340336

341337
#endif /* defined(HAVE_ZLIB_COPY) */
342338

343-
#ifndef ZLIB_DECOMPRESS_COPY_METHODDEF
344-
#define ZLIB_DECOMPRESS_COPY_METHODDEF
345-
#endif /* !defined(ZLIB_DECOMPRESS_COPY_METHODDEF) */
346-
347339
PyDoc_STRVAR(zlib_Decompress_flush__doc__,
348340
"flush($self, length=zlib.DEF_BUF_SIZE, /)\n"
349341
"--\n"
@@ -450,4 +442,8 @@ zlib_crc32(PyModuleDef *module, PyObject *args)
450442

451443
return return_value;
452444
}
453-
/*[clinic end generated code: output=bc9473721ca7c962 input=a9049054013a1b77]*/
445+
446+
#ifndef ZLIB_COMPRESS_COPY_METHODDEF
447+
#define ZLIB_COMPRESS_COPY_METHODDEF
448+
#endif /* !defined(ZLIB_COMPRESS_COPY_METHODDEF) */
449+
/*[clinic end generated code: output=901c18189767dc08 input=a9049054013a1b77]*/

Modules/posixmodule.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17130,10 +17130,6 @@ dump buffer
1713017130
#define OS_SYSTEM_METHODDEF
1713117131
#endif /* !defined(OS_SYSTEM_METHODDEF) */
1713217132

17133-
#ifndef OS_SYSTEM_METHODDEF
17134-
#define OS_SYSTEM_METHODDEF
17135-
#endif /* !defined(OS_SYSTEM_METHODDEF) */
17136-
1713717133
#ifndef OS_UNAME_METHODDEF
1713817134
#define OS_UNAME_METHODDEF
1713917135
#endif /* !defined(OS_UNAME_METHODDEF) */
@@ -17306,10 +17302,6 @@ dump buffer
1730617302
#define OS_WAITPID_METHODDEF
1730717303
#endif /* !defined(OS_WAITPID_METHODDEF) */
1730817304

17309-
#ifndef OS_WAITPID_METHODDEF
17310-
#define OS_WAITPID_METHODDEF
17311-
#endif /* !defined(OS_WAITPID_METHODDEF) */
17312-
1731317305
#ifndef OS_WAIT_METHODDEF
1731417306
#define OS_WAIT_METHODDEF
1731517307
#endif /* !defined(OS_WAIT_METHODDEF) */
@@ -17410,10 +17402,6 @@ dump buffer
1741017402
#define OS_PUTENV_METHODDEF
1741117403
#endif /* !defined(OS_PUTENV_METHODDEF) */
1741217404

17413-
#ifndef OS_PUTENV_METHODDEF
17414-
#define OS_PUTENV_METHODDEF
17415-
#endif /* !defined(OS_PUTENV_METHODDEF) */
17416-
1741717405
#ifndef OS_UNSETENV_METHODDEF
1741817406
#define OS_UNSETENV_METHODDEF
1741917407
#endif /* !defined(OS_UNSETENV_METHODDEF) */
@@ -17521,7 +17509,7 @@ dump buffer
1752117509
#ifndef OS_SET_HANDLE_INHERITABLE_METHODDEF
1752217510
#define OS_SET_HANDLE_INHERITABLE_METHODDEF
1752317511
#endif /* !defined(OS_SET_HANDLE_INHERITABLE_METHODDEF) */
17524-
/*[clinic end generated code: output=52a6140b0b052ce6 input=524ce2e021e4eba6]*/
17512+
/*[clinic end generated code: output=b788c2d6010113e8 input=524ce2e021e4eba6]*/
1752517513

1752617514

1752717515
static PyMethodDef posix_methods[] = {

0 commit comments

Comments
 (0)