Skip to content

Commit

Permalink
Issue #23500: Argument Clinic is now smarter about generating the "#i…
Browse files Browse the repository at this point in the history
…fndef"

(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.
  • Loading branch information
larryhastings committed Apr 3, 2015
1 parent 5cf2b72 commit 0759f84
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 92 deletions.
5 changes: 5 additions & 0 deletions Misc/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,11 @@ Tests
Tools/Demos
-----------

- 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.

- Issue #22826: The result of open() in Tools/freeze/bkfile.py is now better
compatible with regular files (in particular it now supports the context
management protocol).
Expand Down
10 changes: 5 additions & 5 deletions Modules/clinic/spwdmodule.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ spwd_getspnam(PyModuleDef *module, PyObject *args)

#endif /* defined(HAVE_GETSPNAM) */

#ifndef SPWD_GETSPNAM_METHODDEF
#define SPWD_GETSPNAM_METHODDEF
#endif /* !defined(SPWD_GETSPNAM_METHODDEF) */

#if defined(HAVE_GETSPENT)

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

#endif /* defined(HAVE_GETSPENT) */

#ifndef SPWD_GETSPNAM_METHODDEF
#define SPWD_GETSPNAM_METHODDEF
#endif /* !defined(SPWD_GETSPNAM_METHODDEF) */

#ifndef SPWD_GETSPALL_METHODDEF
#define SPWD_GETSPALL_METHODDEF
#endif /* !defined(SPWD_GETSPALL_METHODDEF) */
/*[clinic end generated code: output=41fec4a15b0cd2a0 input=a9049054013a1b77]*/
/*[clinic end generated code: output=ab16125c5e5f2b1b input=a9049054013a1b77]*/
14 changes: 5 additions & 9 deletions Modules/clinic/zlibmodule.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,6 @@ zlib_Compress_copy(compobject *self, PyObject *Py_UNUSED(ignored))

#endif /* defined(HAVE_ZLIB_COPY) */

#ifndef ZLIB_COMPRESS_COPY_METHODDEF
#define ZLIB_COMPRESS_COPY_METHODDEF
#endif /* !defined(ZLIB_COMPRESS_COPY_METHODDEF) */

#if defined(HAVE_ZLIB_COPY)

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

#endif /* defined(HAVE_ZLIB_COPY) */

#ifndef ZLIB_DECOMPRESS_COPY_METHODDEF
#define ZLIB_DECOMPRESS_COPY_METHODDEF
#endif /* !defined(ZLIB_DECOMPRESS_COPY_METHODDEF) */

PyDoc_STRVAR(zlib_Decompress_flush__doc__,
"flush($self, length=zlib.DEF_BUF_SIZE, /)\n"
"--\n"
Expand Down Expand Up @@ -450,4 +442,8 @@ zlib_crc32(PyModuleDef *module, PyObject *args)

return return_value;
}
/*[clinic end generated code: output=bc9473721ca7c962 input=a9049054013a1b77]*/

#ifndef ZLIB_COMPRESS_COPY_METHODDEF
#define ZLIB_COMPRESS_COPY_METHODDEF
#endif /* !defined(ZLIB_COMPRESS_COPY_METHODDEF) */
/*[clinic end generated code: output=901c18189767dc08 input=a9049054013a1b77]*/
14 changes: 1 addition & 13 deletions Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -17130,10 +17130,6 @@ dump buffer
#define OS_SYSTEM_METHODDEF
#endif /* !defined(OS_SYSTEM_METHODDEF) */

#ifndef OS_SYSTEM_METHODDEF
#define OS_SYSTEM_METHODDEF
#endif /* !defined(OS_SYSTEM_METHODDEF) */

#ifndef OS_UNAME_METHODDEF
#define OS_UNAME_METHODDEF
#endif /* !defined(OS_UNAME_METHODDEF) */
Expand Down Expand Up @@ -17306,10 +17302,6 @@ dump buffer
#define OS_WAITPID_METHODDEF
#endif /* !defined(OS_WAITPID_METHODDEF) */

#ifndef OS_WAITPID_METHODDEF
#define OS_WAITPID_METHODDEF
#endif /* !defined(OS_WAITPID_METHODDEF) */

#ifndef OS_WAIT_METHODDEF
#define OS_WAIT_METHODDEF
#endif /* !defined(OS_WAIT_METHODDEF) */
Expand Down Expand Up @@ -17410,10 +17402,6 @@ dump buffer
#define OS_PUTENV_METHODDEF
#endif /* !defined(OS_PUTENV_METHODDEF) */

#ifndef OS_PUTENV_METHODDEF
#define OS_PUTENV_METHODDEF
#endif /* !defined(OS_PUTENV_METHODDEF) */

#ifndef OS_UNSETENV_METHODDEF
#define OS_UNSETENV_METHODDEF
#endif /* !defined(OS_UNSETENV_METHODDEF) */
Expand Down Expand Up @@ -17521,7 +17509,7 @@ dump buffer
#ifndef OS_SET_HANDLE_INHERITABLE_METHODDEF
#define OS_SET_HANDLE_INHERITABLE_METHODDEF
#endif /* !defined(OS_SET_HANDLE_INHERITABLE_METHODDEF) */
/*[clinic end generated code: output=52a6140b0b052ce6 input=524ce2e021e4eba6]*/
/*[clinic end generated code: output=b788c2d6010113e8 input=524ce2e021e4eba6]*/


static PyMethodDef posix_methods[] = {
Expand Down
Loading

0 comments on commit 0759f84

Please sign in to comment.