Skip to content

Commit

Permalink
Merge branch 'main' into fix-exeptions-append-after-cancel-async-stagger
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert authored Jan 4, 2025
2 parents 62c83a2 + a4e773c commit f75d77a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ repos:
hooks:
- id: check-dependabot
- id: check-github-workflows
- id: check-readthedocs

- repo: https://github.com/rhysd/actionlint
rev: v1.7.4
Expand Down
10 changes: 10 additions & 0 deletions Lib/test/test_clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,16 @@ def test_cloned_forced_text_signature_illegal(self):
err = "Cannot use @text_signature when cloning a function"
self.expect_failure(block, err, lineno=11)

def test_ignore_preprocessor_in_comments(self):
for dsl in "clinic", "python":
raw = dedent(f"""\
/*[{dsl} input]
# CPP directives, valid or not, should be ignored in C comments.
#
[{dsl} start generated code]*/
""")
self.clinic.parse(raw)


class ParseFileUnitTest(TestCase):
def expect_parsing_failure(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix a bug where Argument Clinic's C pre-processor parser tried to parse
pre-processor directives inside C comments. Patch by Erlend Aasland.
3 changes: 3 additions & 0 deletions Tools/clinic/libclinic/cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ def pop_stack() -> TokenAndCondition:
if line_comment:
line = before.rstrip()

if self.in_comment:
return

if not line.startswith('#'):
return

Expand Down

0 comments on commit f75d77a

Please sign in to comment.