Skip to content

bpo-37961: fix regression in tracemalloc.Traceback.__repr__ #23805

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 2 commits into from
Dec 16, 2020

Conversation

blueyed
Copy link
Contributor

@blueyed blueyed commented Dec 16, 2020

Regression in 8d59eb1
(v3.8.0b1-1208-g8d59eb1b66).

https://bugs.python.org/issue37961

Regression in 8d59eb1
(v3.8.0b1-1208-g8d59eb1b66).
@blueyed
Copy link
Contributor Author

blueyed commented Dec 16, 2020

/cc @jd

@@ -226,7 +226,7 @@ def __str__(self):
return str(self[0])

def __repr__(self):
s = "<Traceback %r" % tuple(self)
s = f"<Traceback {tuple(self)}"
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm confused about what this changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"%r" % (1,2,3) raises: "TypeError: not all arguments converted during string formatting".
This was changed (apparently unintentionally) in 8d59eb1#diff-cbaacb7ac396956c9595b4899ef2ab31b02b264099e02eba56fbe2f5f2e441c0L224-R229.

Copy link
Contributor

Choose a reason for hiding this comment

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

nice catch

@vstinner
Copy link
Member

Can you please explain what is the bug? https://bugs.python.org/issue37961 is closed, I suggest to open a new issue to explain your bug.

@blueyed
Copy link
Contributor Author

blueyed commented Dec 16, 2020

@vstinner

Can you please explain what is the bug? https://bugs.python.org/issue37961 is closed, I suggest to open a new issue to explain your bug.

I wanted to avoid noise in the issue tracker, but can do so later if you still think it is not a fixup/follow-up to the closed issue.

@miss-islington
Copy link
Contributor

Thanks @blueyed for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 16, 2020
…-23805)

Regression in 8d59eb1.
(cherry picked from commit 051b981)

Co-authored-by: Daniel Hahler <[email protected]>
@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Dec 16, 2020
@bedevere-bot
Copy link

GH-23809 is a backport of this pull request to the 3.9 branch.

@vstinner
Copy link
Member

The 3.8 branch is not affected:

        return "<Traceback %r>" % (tuple(self),)

@vstinner
Copy link
Member

Well spotted, thanks for the fix, especially for additional tests! I merged your PR and backported it to 3.9.

@blueyed blueyed deleted the fix-tracemalloc-traceback-repr branch December 16, 2020 21:51
miss-islington added a commit that referenced this pull request Dec 16, 2020
Regression in 8d59eb1.
(cherry picked from commit 051b981)

Co-authored-by: Daniel Hahler <[email protected]>
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants