-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
Argument Clinic's [python input]
blocks do not support empty lines in comments
#128152
Comments
[python input]
blocks do not supported nested C comments[python input]
blocks do not support empty lines in comments
I've had a quick look at the failure and this happens before we've detected the @erlend-aasland I don't really know how to fix this and it's not really an issue since I can just write some fake characters to simulate an empty line (e.g., |
I've opened a PR for this issue. I think the problem was that empty lines were breaking the logic so if they don't reach it there should be no more error. |
As I said on the PR, I'm not sure this is the best approach. The "empty lines" that are detected at this stage are actually lines of the form |
This has nothing to do with [clinic input] repro$ cat > buggy.c
/*[clinic input]
# comment
#
[clinic start generated code]*/
$ ./Tools/clinic/clinic.py buggy.c
Traceback (most recent call last):
File "/Users/erlend.aasland/src/python/main/./Tools/clinic/clinic.py", line 11, in <module>
main()
~~~~^^
File "/Users/erlend.aasland/src/python/main/Tools/clinic/libclinic/cli.py", line 226, in main
run_clinic(parser, args)
~~~~~~~~~~^^^^^^^^^^^^^^
File "/Users/erlend.aasland/src/python/main/Tools/clinic/libclinic/cli.py", line 218, in run_clinic
parse_file(filename, output=ns.output,
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
verify=not ns.force, limited_capi=ns.limited_capi)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/erlend.aasland/src/python/main/Tools/clinic/libclinic/cli.py", line 84, in parse_file
cooked = clinic.parse(raw)
File "/Users/erlend.aasland/src/python/main/Tools/clinic/libclinic/app.py", line 186, in parse
for block in self.block_parser:
^^^^^^^^^^^^^^^^^
File "/Users/erlend.aasland/src/python/main/Tools/clinic/libclinic/block_parser.py", line 132, in __next__
return_value = self.parse_clinic_block(self.dsl_name)
File "/Users/erlend.aasland/src/python/main/Tools/clinic/libclinic/block_parser.py", line 194, in parse_clinic_block
line = self._line()
File "/Users/erlend.aasland/src/python/main/Tools/clinic/libclinic/block_parser.py", line 155, in _line
self.language.parse_line(line)
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/Users/erlend.aasland/src/python/main/Tools/clinic/libclinic/clanguage.py", line 70, in parse_line
self.cpp.writeline(line)
~~~~~~~~~~~~~~~~~~^^^^^^
File "/Users/erlend.aasland/src/python/main/Tools/clinic/libclinic/cpp.py", line 139, in writeline
assert line
^^^^
AssertionError |
Yes, that's why I'm asking if this is possible to pre-determine the DSL before parsing the C file (a two-pass parsing) so that |
The problem seems to be in |
…ide C comments (pythonGH-128464) (cherry picked from commit a4e773c) Co-authored-by: Erlend E. Aasland <erlend@python.org>
Bug report
Bug description:
The following is not a valid Python input clinic but should be:
This results in an assertion error:
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
The text was updated successfully, but these errors were encountered: