Skip to content

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

@cdrx

Description

@cdrx

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions