Skip to content

bug: ExprJoinedStr and ExprTemplateStr don't always produce correct code #444

Description

@pawamoy

Description of the bug

These two classes produce code by hardcoding single quotes at the beginning and end of the strings. This can produce invalid code if the string contains additional single quotes.

To Reproduce

TODO

Full traceback

/

Expected behavior

We should produce valid code, always.

Environment information

griffe --debug-info  # | xclip -selection clipboard
  • System: Linux-6.18.7-arch1-1-x86_64-with-glibc2.42
  • Python: cpython 3.14.2 (/run/media/pawamoy/Data/dev/griffe/.venv/bin/python3)
  • Environment variables:
  • Installed packages:
    • griffelib v1.15.1.dev12+g162c31c2
    • griffecli v1.15.1.dev12+g162c31c2
    • griffe v1.15.1.dev12+g162c31c2

Additional context

Spotted in #440

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions