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

Argument Clinic's [python input] blocks do not support /* in literal strings #128153

Open
picnixz opened this issue Dec 21, 2024 · 0 comments
Open
Labels
topic-argument-clinic type-bug An unexpected behavior, bug, or error

Comments

@picnixz
Copy link
Contributor

picnixz commented Dec 21, 2024

Bug report

Bug description:

The following is not a valid Python input clinic but should be:

/*[python input]
print("/* this is a comment *\/")
[python start generated code]*/

Note that the inner C comment should be *\/ because otherwise IDEs will consider the block comment to be closed resulting in syntax errors (for the C file). Another example is just:

/*[python input]
x = "/*"
[python start generated code]*/

Both result in the following error (I've just added the AC directive in the first file I had opened):

$ python3 ./Tools/clinic/clinic.py --force --make --exclude Lib/test/clinic.test.c --srcdir .
Error in file 'Modules/sha1module.c' on line 270:
Nested block comment!
make: *** [Makefile:1055: clinic] Error 1

For now the workaround is to break /* into multiple strings: x = "/" + "*" for instance.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

@picnixz picnixz added type-bug An unexpected behavior, bug, or error topic-argument-clinic labels Dec 21, 2024
@picnixz picnixz changed the title Argument Clinic's [python input] blocks do not support /* in literal strings Argument Clinic's [python input] blocks do not support /* in literal strings Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-argument-clinic type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant