From: Alex Waygood Date: Sat, 29 Jul 2023 18:47:42 +0000 (+0100) Subject: gh-104683: Argument clinic: pass `clinic` as a parameter where possible (#107435) X-Git-Tag: v3.13.0a1~1136 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5113ed7a2b92e8beabebe5fe2f6e856c52fbe1a0;p=thirdparty%2FPython%2Fcpython.git gh-104683: Argument clinic: pass `clinic` as a parameter where possible (#107435) --- diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index 3c16dc389e3e..defe703b825b 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -805,7 +805,8 @@ class CLanguage(Language): def output_templates( self, - f: Function + f: Function, + clinic: Clinic ) -> dict[str, str]: parameters = list(f.parameters.values()) assert parameters @@ -1324,7 +1325,6 @@ class CLanguage(Language): cpp_if = "#if " + conditional cpp_endif = "#endif /* " + conditional + " */" - assert clinic is not None if methoddef_define and f.full_name not in clinic.ifndef_symbols: clinic.ifndef_symbols.add(f.full_name) methoddef_ifndef = normalize_snippet(""" @@ -1490,7 +1490,7 @@ class CLanguage(Language): parameters = f.render_parameters converters = [p.converter for p in parameters] - templates = self.output_templates(f) + templates = self.output_templates(f, clinic) f_self = parameters[0] selfless = parameters[1:] @@ -4613,7 +4613,7 @@ class DSLParser: self.next(self.state_terminal) self.state(None) - block.output.extend(self.clinic.language.render(clinic, block.signatures)) + block.output.extend(self.clinic.language.render(self.clinic, block.signatures)) if self.preserve_output: if block.output: