Skip to content

Unexpanded f-strings in Lib/test/support/__init__.py exceptions #135074

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
danielhollas opened this issue Jun 3, 2025 · 0 comments · Fixed by #135076
Closed

Unexpanded f-strings in Lib/test/support/__init__.py exceptions #135074

danielhollas opened this issue Jun 3, 2025 · 0 comments · Fixed by #135076
Labels
type-bug An unexpected behavior, bug, or error

Comments

@danielhollas
Copy link
Contributor

danielhollas commented Jun 3, 2025

Bug report

Bug description:

ruff check --target-version=py314 --preview --select RUF027 Lib/test/support/__init__.py 
Lib/test/support/__init__.py:1087:26: RUF027 Possible f-string without an `f` prefix
     |
1085 |     memlimit = _parse_memlimit(limit)
1086 |     if memlimit < _2G - 1:
1087 |         raise ValueError('Memory limit {limit!r} too low to be useful')
     |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF027
1088 |
1089 |     real_max_memuse = memlimit
     |
     = help: Add `f` prefix

Lib/test/support/__init__.py:2361:26: RUF027 Possible f-string without an `f` prefix
     |
2359 |         max_depth = 20_000
2360 |     elif max_depth < 3:
2361 |         raise ValueError("max_depth must be at least 3, got {max_depth}")
     |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF027
2362 |     depth = get_recursion_depth()
2363 |     depth = max(depth - 1, 1)  # Ignore infinite_recursion() frame.
     |
     = help: Add `f` prefix

Found 2 errors.

Related to #135069

I'll submit a PR shortly.

CPython versions tested on:

CPython main branch, 3.13, 3.14

Operating systems tested on:

No response

Linked PRs

@danielhollas danielhollas added the type-bug An unexpected behavior, bug, or error label Jun 3, 2025
danielhollas added a commit to danielhollas/cpython that referenced this issue Jun 3, 2025
danielhollas added a commit to danielhollas/cpython that referenced this issue Jun 3, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jun 4, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jun 4, 2025
encukou pushed a commit that referenced this issue Jun 4, 2025
encukou pushed a commit that referenced this issue Jun 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant