Skip to content

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

@pawamoy

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

Metadata

Metadata

Assignees

Labels

unconfirmedThis bug was not reproduced yet

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions