forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Proof of concept: gh-64595 fix #37
Closed
erlend-aasland
wants to merge
2
commits into
Argument-Clinic:main
from
erlend-aasland:clinic/touch-source-file-if-clinic-changed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2407,6 +2407,7 @@ def parse(self, input: str) -> str: | |
header_includes=self.includes) | ||
|
||
# these are destinations not buffers | ||
generated = [] | ||
for name, destination in self.destinations.items(): | ||
if destination.type == 'suppress': | ||
continue | ||
|
@@ -2450,11 +2451,12 @@ def parse(self, input: str) -> str: | |
core_includes=True, | ||
limited_capi=self.limited_capi, | ||
header_includes=self.includes) | ||
libclinic.write_file(destination.filename, | ||
printer_2.f.getvalue()) | ||
generated.append((destination.filename, | ||
printer_2.f.getvalue())) | ||
continue | ||
|
||
return printer.f.getvalue() | ||
cooked = printer.f.getvalue() | ||
return generated, cooked | ||
|
||
def _module_and_class( | ||
self, fields: Sequence[str] | ||
|
@@ -2493,6 +2495,7 @@ def parse_file( | |
limited_capi: bool, | ||
output: str | None = None, | ||
verify: bool = True, | ||
force: bool = False, | ||
) -> None: | ||
if not output: | ||
output = filename | ||
|
@@ -2522,9 +2525,14 @@ def parse_file( | |
verify=verify, | ||
filename=filename, | ||
limited_capi=limited_capi) | ||
cooked = clinic.parse(raw) | ||
generated, cooked = clinic.parse(raw) | ||
|
||
libclinic.write_file(output, cooked) | ||
changes = [libclinic.file_changed(f, data) for f, data in generated] | ||
if any(changes) or libclinic.file_changed(output, cooked) or force: | ||
libclinic.write_file(output, cooked) | ||
for (output, cooked), changed in zip(generated, changes): | ||
if changed or force: | ||
libclinic.write_file(output, cooked) | ||
|
||
|
||
class PythonParser: | ||
|
@@ -6295,7 +6303,8 @@ def run_clinic(parser: argparse.ArgumentParser, ns: argparse.Namespace) -> None: | |
if ns.verbose: | ||
print(path) | ||
parse_file(path, | ||
verify=not ns.force, limited_capi=ns.limited_capi) | ||
verify=not ns.force, limited_capi=ns.limited_capi, | ||
force=ns.force) | ||
Comment on lines
+6306
to
+6307
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Feels silly that |
||
return | ||
|
||
if not ns.filename: | ||
|
@@ -6308,7 +6317,8 @@ def run_clinic(parser: argparse.ArgumentParser, ns: argparse.Namespace) -> None: | |
if ns.verbose: | ||
print(filename) | ||
parse_file(filename, output=ns.output, | ||
verify=not ns.force, limited_capi=ns.limited_capi) | ||
verify=not ns.force, limited_capi=ns.limited_capi, | ||
force=ns.force) | ||
|
||
|
||
def main(argv: list[str] | None = None) -> NoReturn: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need better naming here.
cooked
must go.