Skip to content

Escape backslashes in generated docstrings#3566

Draft
Mirochill wants to merge 1 commit into
DataDog:masterfrom
Mirochill:fix-3535-docstring-backslashes
Draft

Escape backslashes in generated docstrings#3566
Mirochill wants to merge 1 commit into
DataDog:masterfrom
Mirochill:fix-3535-docstring-backslashes

Conversation

@Mirochill
Copy link
Copy Markdown

What does this PR do?

Fixes #3535.

Generated API docstrings can include literal backslashes from OpenAPI descriptions. When those backslashes are written directly into Python triple-quoted docstrings, Python 3.13+ can emit SyntaxWarning for invalid escape sequences such as \s.

This updates the generator docstring formatter so rendered backslashes are escaped for Python string literals, adds a formatter regression for a regex-style \s example, and updates the currently affected generated LogsPipelinesApi docstring.

Additional Notes

No local tests were run. This workspace policy forbids running third-party project tests, builds, linters, installers, or project scripts locally; validation was limited to static diff review and git diff --check HEAD~1..HEAD.

Review checklist

Please check relevant items below:

  • This PR includes all newly recorded cassettes for any modified tests.

  • This PR does not rely on API client schema changes.

    • The CI should be fully passing.
  • Or, this PR relies on API schema changes and this is a Draft PR to include tests for that new functionality.

    • Note: CI shouldn't be run on this Draft PR, as its expected to fail without the corresponding schema changes.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python 3.13/3.14 SyntaxWarning in v1 LogsPipelinesApi docstring

1 participant