diff -r 5c73b01d58ac Modules/clinic/spwdmodule.c.h --- a/Modules/clinic/spwdmodule.c.h Wed Mar 04 09:44:24 2015 +0200 +++ b/Modules/clinic/spwdmodule.c.h Wed Mar 04 17:05:29 2015 +0200 @@ -36,10 +36,6 @@ exit: #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__, @@ -64,7 +60,11 @@ spwd_getspall(PyModuleDef *module, PyObj #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]*/ diff -r 5c73b01d58ac Modules/clinic/zlibmodule.c.h --- a/Modules/clinic/zlibmodule.c.h Wed Mar 04 09:44:24 2015 +0200 +++ b/Modules/clinic/zlibmodule.c.h Wed Mar 04 17:05:29 2015 +0200 @@ -314,10 +314,6 @@ zlib_Compress_copy(compobject *self, PyO #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__, @@ -340,10 +336,6 @@ zlib_Decompress_copy(compobject *self, P #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" @@ -450,4 +442,12 @@ exit: 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) */ + +#ifndef ZLIB_DECOMPRESS_COPY_METHODDEF + #define ZLIB_DECOMPRESS_COPY_METHODDEF +#endif /* !defined(ZLIB_DECOMPRESS_COPY_METHODDEF) */ +/*[clinic end generated code: output=f058fcf26424db81 input=a9049054013a1b77]*/ diff -r 5c73b01d58ac Tools/clinic/clinic.py --- a/Tools/clinic/clinic.py Wed Mar 04 09:44:24 2015 +0200 +++ b/Tools/clinic/clinic.py Wed Mar 04 17:05:29 2015 +0200 @@ -1408,10 +1408,10 @@ class Destination: self.name = name self.type = type self.clinic = clinic - valid_types = ('buffer', 'file', 'suppress', 'two-pass') + valid_types = ('buffer', 'file', 'suppress', 'two-pass', 'append') if type not in valid_types: fail("Invalid destination type " + repr(type) + " for " + name + " , must be " + ', '.join(valid_types)) - extra_arguments = 1 if type == "file" else 0 + extra_arguments = 1 if type in ('file', 'append') else 0 if len(args) < extra_arguments: fail("Not enough arguments for destination " + name + " new " + type) if len(args) > extra_arguments: @@ -1427,8 +1427,10 @@ class Destination: d['basename'] = basename d['basename_root'], d['basename_extension'] = os.path.splitext(filename) self.filename = args[0].format_map(d) - if type == 'two-pass': + elif type == 'two-pass': self.id = None + elif type == 'append': + self.target, = args self.text, self.append, self._dump = _text_accumulator() @@ -1508,6 +1510,7 @@ everything file docstring_prototype suppress parser_prototype suppress impl_definition block +methoddef_ifndef append-file preset buffer everything buffer @@ -1515,6 +1518,7 @@ docstring_prototype suppress impl_prototype suppress parser_prototype suppress impl_definition block +methoddef_ifndef append-buffer preset partial-buffer everything buffer @@ -1523,6 +1527,7 @@ impl_prototype suppress methoddef_define block parser_prototype block impl_definition block +methoddef_ifndef append-buffer preset two-pass everything buffer @@ -1531,6 +1536,7 @@ impl_prototype suppress methoddef_define two-pass parser_prototype two-pass impl_definition block +methoddef_ifndef append-buffer """ @@ -1555,9 +1561,11 @@ impl_definition block self.add_destination("block", "buffer") self.add_destination("suppress", "suppress") self.add_destination("buffer", "buffer") + self.add_destination('append-buffer', 'append', 'buffer') self.add_destination("two-pass", "two-pass") if filename: self.add_destination("file", "file", "{dirname}/clinic/{basename}.h") + self.add_destination('append-file', 'append', 'file') d = self.destinations.get self.field_destinations = collections.OrderedDict(( @@ -1569,7 +1577,7 @@ impl_definition block ('parser_prototype', d('suppress')), ('parser_definition', d('block')), ('cpp_endif', d('suppress')), - ('methoddef_ifndef', d('buffer')), + ('methoddef_ifndef', d('append-buffer')), ('impl_definition', d('block')), )) @@ -1632,6 +1640,11 @@ impl_definition block second_pass_replacements = {} for name, destination in self.destinations.items(): + if destination.type == 'append': + target = self.destinations[destination.target] + target.append(destination._dump()) + + for name, destination in self.destinations.items(): if destination.type == 'suppress': continue output = destination._dump() @@ -3142,6 +3155,9 @@ class DSLParser: def directive_dump(self, name): self.block.output.append(self.clinic.get_destination(name).dump()) + for destination in self.clinic.destinations.values(): + if destination.type == 'append' and destination.target == name: + self.block.output.append(destination._dump()) def directive_print(self, *args): self.block.output.append(' '.join(args))