Skip to content

fix: escape backslash in ClaudeFile.filename description - #3309

Open
VISHNU0906 wants to merge 1 commit into
googleapis:mainfrom
VISHNU0906:fix/issue-3308-invalid-escape
Open

VISHNU0906 wants to merge 1 commit into
googleapis:mainfrom
VISHNU0906:fix/issue-3308-invalid-escape

Conversation

@VISHNU0906

Copy link
Copy Markdown

Summary

Importing google.genai on Python 3.12+ emits:

SyntaxWarning: "\/" is an invalid escape sequence. Did you mean "\\/"?

ClaudeFile.filename (Field description and TypedDict docstring) used \/ in a regular string. Escape it as \\/ so the documented rejected character set still includes both \ and /, with no warning.

Fixes #3308

cc @s-banach

Notes

google/genai/types.py is marked generated (DO NOT EDIT). The generator / schema that emits this description is not in this public tree, so this PR patches the checked-in output. Please mirror the escape in the generator source so a regen does not reintroduce the warning.

Test plan

  • python -W error::SyntaxWarning -c "import google.genai" succeeds
  • compile(..., 'exec') of types.py reports zero SyntaxWarnings
  • Runtime description text still contains both \ and /
  • pytest google/genai/tests/imports/ (2 passed, 1 skipped)

The File.filename Field description and TypedDict docstring used
`\/` in a regular string, which triggers SyntaxWarning on Python
3.12+ when google.genai is imported. Escape as `\\/` so the
documented character set still includes both `\` and `/`.

Fixes googleapis#3308

Signed-off-by: KVR Vishnu <[email protected]>

This branch has not been deployed

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

Labels

size:S Code changes < 10 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SyntaxWarning on import in 3.0.0 (invalid escape sequence in types.py)

2 participants