Skip to content

bpo-36251: Fix format strings used in match_repr() and stdprinter_repr() #12252

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

Merged
merged 4 commits into from
Mar 10, 2019

Conversation

sth
Copy link
Contributor

@sth sth commented Mar 9, 2019

In match_repr(), the marks are Py_ssize_t, not int.

In stdprinter_repr(), the argument is a pointer and the correct format specifier for that is %p (this includes the 0x prefix).

For reference: The docs for PyUnicode_FromFormat

https://bugs.python.org/issue36251

sth added 2 commits March 9, 2019 15:33
The `mark`s are Py_ssize_t, not `int`. The correct format specifier for
that is %zd.
The appropriate format specifier to print a pointer as 0x.... is %p.
Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

LGTM, except that it is better to use names visible from the Python side, because readers of the changelog are Python users.

@miss-islington
Copy link
Contributor

Thanks @sth for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

@serhiy-storchaka serhiy-storchaka added the type-bug An unexpected behavior, bug, or error label Mar 10, 2019
@bedevere-bot
Copy link

GH-12263 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 10, 2019
…r(). (pythonGH-12252)

(cherry picked from commit 8b91eda)

Co-authored-by: sth <sth.dev@tejp.de>
miss-islington added a commit that referenced this pull request Mar 10, 2019
…r(). (GH-12252)

(cherry picked from commit 8b91eda)

Co-authored-by: sth <sth.dev@tejp.de>
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 this pull request may close these issues.

5 participants