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

[BUG] self documenting expressions in f-strings #3796

Closed
cdrx opened this issue Aug 28, 2020 · 2 comments · Fixed by #3939
Closed

[BUG] self documenting expressions in f-strings #3796

cdrx opened this issue Aug 28, 2020 · 2 comments · Fixed by #3939

Comments

@cdrx
Copy link

cdrx commented Aug 28, 2020

Describe the bug

Python 3.8 added support for the = specifier in f-strings to provide self documenting expressions. Using this feature makes a file fail to compile.

To Reproduce

test.py:

x = 1
print(f"{x=}")

then run:

$ python test.py
x=1

$ cython -3 test.py

Error compiling Cython file:
------------------------------------------------------------
...
x = 1
print(f"{x=}")
            ^
------------------------------------------------------------

test.py:2:13: Expected ')', found '='

Expected behavior
No error compiling the file

Environment (please complete the following information):

  • OS: macOS
  • Python version 3.8.3
  • Cython version 0.29.21

Additional context

https://docs.python.org/3/whatsnew/3.8.html#f-strings-support-for-self-documenting-expressions-and-debugging

@cdrx cdrx changed the title [BUG] self documenting [BUG] self documenting expressions in f-strings Aug 28, 2020
@StefanD986
Copy link

I can confirm this also in Cython==3.0a6 on windows.

@scoder
Copy link
Contributor

scoder commented Nov 9, 2020

Probably easy to implement in Parsing.py. PR welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants