Skip to content

[pylint] Fix PLE1307 false positive with bools - #27651

Merged
ntBre merged 2 commits into
astral-sh:mainfrom
Andrej730:bad-string-format-bool
Aug 11, 2026
Merged

ntBre merged 2 commits into
astral-sh:mainfrom
Andrej730:bad-string-format-bool

Conversation

@Andrej730

@Andrej730 Andrej730 commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Was working on a refactor for https://docs.astral.sh/ruff/rules/bad-string-format-type/ and found a bug - it incorrectly flags any use of bools unless they're used with %s, %r. See example below, on the runtime it runs without errors and prints 1 \x01 1.000000.

  |
1 | # PLE1307 Format type does not match argument type
2 | # OK.
3 | print("%d %c %f" % (True, True, True))
  |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Test Plan

Added new test - note it's producing an error in 03625fe and fixed in 6f3e7bf
All previous tests also pass.

@astral-sh-bot
astral-sh-bot Bot requested a review from ntBre August 11, 2026 14:03
@astral-sh-bot

astral-sh-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@ntBre ntBre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ntBre ntBre added the bug An issue describing something that isn't working, or a PR that fixes a bug label Aug 11, 2026
@ntBre
ntBre merged commit feb64f2 into astral-sh:main Aug 11, 2026
47 checks passed
@Andrej730
Andrej730 deleted the bad-string-format-bool branch August 11, 2026 18:33
George-Ogden pushed a commit to George-Ogden/ruff that referenced this pull request Aug 16, 2026
## Summary

Was working on a refactor for
https://docs.astral.sh/ruff/rules/bad-string-format-type/ and found a
bug - it incorrectly flags any use of bools unless they're used with
`%s`, `%r`. See example below, on the runtime it runs without errors and
prints `1 \x01 1.000000`.

```python
  |
1 | # PLE1307 Format type does not match argument type
2 | # OK.
3 | print("%d %c %f" % (True, True, True))
  |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```


## Test Plan

Added new test - note it's producing an error in
03625fe and fixed in
6f3e7bf
All previous tests also pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug An issue describing something that isn't working, or a PR that fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants