Skip to content
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

gh-130928: Fix error message during bytes formatting for the 'i' flag #130967

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ApostolFet
Copy link
Contributor

@ApostolFet ApostolFet commented Mar 7, 2025

Error output before correction:

>>> 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

Error output after correction:

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

Copy link
Contributor

@jstasiak jstasiak left a comment

Choose a reason for hiding this comment

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

I think I'd add a unit test for this.

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Yes, please, add a unit test :)
And also a NEWS entry. This is a user-visible change.

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Thanks, I think that the fix is correct.
But, let's wait for @serhiy-storchaka review, because his is the code owner.

@sobolevn
Copy link
Member

sobolevn commented Mar 9, 2025

You can also add yourself to https://github.com/python/cpython/blob/main/Misc/ACKS

@ApostolFet
Copy link
Contributor Author

You can also add yourself to https://github.com/python/cpython/blob/main/Misc/ACKS

Thanks, but I've already taken advantage of that opportunity earlier

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

Successfully merging this pull request may close these issues.

3 participants