Content-Length: 277297 | pFad | https://github.com/python/cpython/issues/130928

D6 Not accurate when outputting an error during byte formatting for the 'i' flag, the 'd' flag is output, which can be misleading · Issue #130928 · python/cpython · GitHub
Skip to content

Not accurate when outputting an error during byte formatting for the 'i' flag, the 'd' flag is output, which can be misleading #130928

@ApostolFet

Description

@ApostolFet

Bug report

Bug description:

Code for demonstration:

>>> b"%i" % "str"
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    b"%i" % "str"
    ~~~~~~^~~~~~~
TypeError: %d format: a real number is required, not str

Expected error message text:

TypeError: %i format: a real number is required, not str

Also for strings this message is output correctly:

>>> "%i" % "str"
Traceback (most recent call last):
  File "<python-input-1>", line 1, in <module>
    "%i" % "str"
    ~~~~~^~~~~~~
TypeError: %i format: a real number is required, not str

I would like to send a PR to fix this.

CPython versions tested on:

3.12, 3.13, 3.14, CPython main branch

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

Labels

interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions









    ApplySandwichStrip

    pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


    --- a PPN by Garber Painting Akron. With Image Size Reduction included!

    Fetched URL: https://github.com/python/cpython/issues/130928

    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy