8000 Wrong f-string parsing and compile warning · Issue #840 · evhub/coconut · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Wrong f-string parsing and compile warning #840
Closed
@shilkazx

Description

@shilkazx

coconut v3.1.0 with python v3.9.18
coconut can not parse multi-line f-string properly. It will remove 'f' before the multi-line string and the compiled code is wrong.
e.g.
coconut code:

sql = f'''SELECT * 
                FROM SOME_TABLE
                WHERE CODE = '{self.code}' '''

compile this code would raise warning:
CoconutSyntaxWarning: f-string with no expressions (line xxx in 'xxx.coco')
and the compiled code is:

sql = '''SELECT * 
                FROM SOME_TABLE
                WHERE CODE = '{self.code}' '''.format()

This code is totally wrong. Coconut should just copy the original code snippet in the generated python file.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0