Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-104683: Argument clinic: pass clinic as a parameter where possible #107435

Merged
merged 1 commit into from
Jul 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions Tools/clinic/clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,8 @@ def docstring_for_c_string(

def output_templates(
self,
f: Function
f: Function,
clinic: Clinic
) -> dict[str, str]:
parameters = list(f.parameters.values())
assert parameters
Expand Down Expand Up @@ -1324,7 +1325,6 @@ def parser_body(
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("""
Expand Down Expand Up @@ -1490,7 +1490,7 @@ def render_function(
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:]
Expand Down Expand Up @@ -4614,7 +4614,7 @@ def parse(self, block: Block) -> None:
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:
Expand Down