Skip to content

Tokenizer/untokenizer seems to break when linting multiline strings with variables/emojis #120377

Closed as not planned
@hemanthkini

Description

@hemanthkini

Bug report

Bug description:

Linting this file with the latest versions of pyupgrade and docformatter on Python 3.12.4:

def test(test_arg1):
    content = f"""
    <table style="width: 100%; height: 100%; font-size: 1.1em;">
        <tr>
            <td style="width: 100%; height: 100%;">🔗 This is a test {test_arg1} </td>
        </tr>
    </table>
    """
    return content

seems to break:

def test(test_arg1):
    content = f"""
    <table style="width: 100%; height: 100%; font-size: 1.1em;">
        <tr>
            <td style="width: 100%; height: 100%;">🔗 This is a test {te{test_arg1} </td>
        </tr>
    </table>
    """
    return content

I filed PyCQA/docformatter#282 and asottile/pyupgrade#949; the maintainer of pyupgrade directed me here. I wasn't able to find a duplicate f-string or tokenizer issue, so hoping this is of help - thanks!

CPython versions tested on:

3.12

Operating systems tested on:

Linux, macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixes3.13bugs and security fixes3.14bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions