[cython/cython] [BUG] Nested double quotes supported by python 3.12 not supported in cython (Issue #6208)

0 views
Skip to first unread message

mironleon

unread,
May 21, 2024, 8:03:06 AM5/21/24
to cython/cython, Subscribed

Describe the bug

Trying to cythonize an f-string with nested double quotes fails with an error message. This might be wholly intentional and reasonable, but the nested double quotes are valid in python 3.12 and the cython-lint tool automatically formats your code to use them (also filed a bug report for cython-lint)

Error compiling Cython file:
------------------------------------------------------------
...
def function():
    a = f"foo [{"bar"}]"
                 ^
------------------------------------------------------------

test.pyx:2:17: empty expression not allowed in f-string

Error compiling Cython file:
------------------------------------------------------------
...
def function():
    a = f"foo [{"bar"}]"
                 ^
------------------------------------------------------------

test.pyx:2:17: missing '}' in format string expression

Error compiling Cython file:
------------------------------------------------------------
...
def function():
    a = f"foo [{"bar"}]"
                 ^
------------------------------------------------------------

Code to reproduce the behaviour:

def function():
    a = f"foo [{"bar"}]"
    print(a)

Expected behaviour

Cythonizing correctly and when calling the function outputting:

foo ["bar"]

OS

Linux (Ubuntu 22.04)

Python version

3.12.3

Cython version

3.0.10

Additional context

No response


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <cython/cython/issues/6208@github.com>

da-woods

unread,
May 21, 2024, 12:23:20 PM5/21/24
to cython/cython, Subscribed

Closed #6208 as not planned.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <cython/cython/issue/6208/issue_event/12882594357@github.com>

da-woods

unread,
May 21, 2024, 12:23:21 PM5/21/24
to cython/cython, Subscribed

Duplicate of #5452. Just hasn't been done yet.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <cython/cython/issues/6208/2122995172@github.com>

Reply all
Reply to author
Forward
0 new messages