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] F-string with = special format fails to compile #3920

Closed
davfsa opened this issue Nov 28, 2020 · 2 comments
Closed

[BUG] F-string with = special format fails to compile #3920

davfsa opened this issue Nov 28, 2020 · 2 comments

Comments

@davfsa
Copy link
Contributor

davfsa commented Nov 28, 2020

Describe the bug
The special f-string = causes the file to not compile

To Reproduce
Code to reproduce the behaviour:

foo = "bar"
print(f"{foo=}")

Error

Compiling /home/davfsa/coding/test-bots/test.py because it changed.
[1/1] Cythonizing /home/davfsa/coding/test-bots/test.py
/home/davfsa/coding/hikari/.venv/lib/python3.8/site-packages/Cython/Compiler/Main.py:344: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /home/davfsa/coding/test-bots/test.py
  tree = Parsing.p_module(s, pxd, full_module_name)

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

test.py:2:15: Expected ')', found '='
Traceback (most recent call last):
  File "/home/davfsa/coding/hikari/.venv/bin/cythonize", line 8, in <module>
    sys.exit(main())
  File "/home/davfsa/coding/hikari/.venv/lib/python3.8/site-packages/Cython/Build/Cythonize.py", line 224, in main
    cython_compile(path, options)
  File "/home/davfsa/coding/hikari/.venv/lib/python3.8/site-packages/Cython/Build/Cythonize.py", line 68, in cython_compile
    ext_modules = cythonize(
  File "/home/davfsa/coding/hikari/.venv/lib/python3.8/site-packages/Cython/Build/Dependencies.py", line 1110, in cythonize
    cythonize_one(*args)
  File "/home/davfsa/coding/hikari/.venv/lib/python3.8/site-packages/Cython/Build/Dependencies.py", line 1277, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: /home/davfsa/coding/test-bots/test.py

Expected behavior
Should compile without warning.

Environment

  • OS: Linux
  • Python version 3.8.5
  • Cython version 3.0a6
@davfsa davfsa changed the title [BUG] F-string with special format fails to compile [BUG] F-string with = special format fails to compile Nov 28, 2020
@da-woods
Copy link
Contributor

Duplicate of #3796

@da-woods da-woods marked this as a duplicate of #3796 Nov 28, 2020
@da-woods
Copy link
Contributor

I think this is a known limitation currently. Fixes are obviously welcome

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

No branches or pull requests

2 participants