Skip to content

gh-152490: Fix TypeError when traceback.py formats SyntaxError(NotImplemented) - #152495

Merged
terryjreedy merged 15 commits into
python:mainfrom
Aniketsy:fix-152490
Oct 21, 2026
Merged

terryjreedy merged 15 commits into
python:mainfrom
Aniketsy:fix-152490

Conversation

@Aniketsy

@Aniketsy Aniketsy commented Jun 28, 2026 •

Copy link
Copy Markdown
Contributor

Method traceback.TracebackException._format_syntax_error contains line msg = self.msg or "<no detail available>".
Since 3.14, bool(NotImplemented) raises TypeError and hence so does self.msg or .... Catch it in a try statement.

Comment thread Lib/test/test_traceback.py Outdated

@terryjreedy terryjreedy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I have no opinion on the test change.

Comment thread Misc/NEWS.d/next/Library/2026-06-28-14-37-01.gh-issue-152490.A8qLbF.rst Outdated
Comment thread Lib/traceback.py Outdated
@bedevere-app

bedevere-app Bot commented Jun 28, 2026

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

Aniketsy and others added 2 commits June 29, 2026 06:37
Comment thread Lib/test/test_traceback.py
Comment thread Lib/test/test_traceback.py Outdated
@Aniketsy

Aniketsy commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

@picnixz i've updated with changes, as per your suggestion. please let me know if we need any further improvements. Thanks :)

@picnixz
picnixz self-requested a review July 3, 2026 19:23
Comment thread Lib/traceback.py Outdated
Comment thread Lib/test/test_traceback.py Outdated
Aniketsy and others added 2 commits September 6, 2026 20:33
Co-authored-by: Bénédikt Tran <[email protected]>
Co-authored-by: Bénédikt Tran <[email protected]>
Comment thread Lib/test/test_traceback.py Outdated
Co-authored-by: Bénédikt Tran <[email protected]>
@terryjreedy terryjreedy self-assigned this Oct 19, 2026
@terryjreedy terryjreedy added needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Oct 19, 2026
Comment thread Lib/traceback.py Outdated

@terryjreedy terryjreedy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perhaps a formal approval will clear CI to green. I hope to merge tomorrow (Tuesday) and submit a followup about only replacing blanks with the message.

@terryjreedy

Copy link
Copy Markdown
Member

@Aniketsy I have never seen these failures and don't think they should be possible for pure python PR. Did you possibly touch, view, load in editor, or otherwise somehow change last-change date or something of autoconf or generated files in your local repository? (I also asked for help elsewhere from other coredevs.)

@Aniketsy

Aniketsy commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor Author

@Aniketsy I have never seen these failures and don't think they should be possible for pure python PR. Did you possibly touch, view, load in editor, or otherwise somehow change last-change date or something of autoconf or generated files in your local repository? (I also asked for help elsewhere from other coredevs.)

@terryjreedy sorry but i don't think i've touched anything, you mentioned.. and yesterday i thought it was from extra line in whatsnew entry, so i removed that but i guess i was wrong.

@Aniketsy

Copy link
Copy Markdown
Contributor Author

lets see if this fixes

@Aniketsy

Copy link
Copy Markdown
Contributor Author

@terryjreedy i've fixed 😊

@terryjreedy terryjreedy changed the title gh-152490: Fix TypeError when formatting SyntaxError with msg=NotImplemented in traceback.py gh-152490: Fix TypeError when traceback.py formats SyntaxError(NotImplemented) Oct 21, 2026
@terryjreedy
terryjreedy merged commit 5503a5e into python:main Oct 21, 2026
53 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @Aniketsy for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Oct 21, 2026

Copy link
Copy Markdown

GH-160009 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Oct 21, 2026
@bedevere-app

bedevere-app Bot commented Oct 21, 2026

Copy link
Copy Markdown

GH-160010 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Oct 21, 2026
terryjreedy added a commit that referenced this pull request Oct 21, 2026
…(NotImplemented) (GH-152495) (#160010)

gh-152490: Fix TypeError when traceback.py formats SyntaxError(NotImplemented) (GH-152495)

Method traceback.TracebackException._format_syntax_error contains line `msg = self.msg or "<no detail available>"`.
Since 3.14, bool(NotImplemented) raises TypeError and hence so does `self.msg or ...`.  Catch it in a try statement.

---------
(cherry picked from commit 5503a5e)

Co-authored-by: Aniket <[email protected]>
Co-authored-by: Terry Jan Reedy <[email protected]>
Co-authored-by: Bénédikt Tran <[email protected]>
terryjreedy added a commit that referenced this pull request Oct 21, 2026
…(NotImplemented) (GH-152495) (#160009)

gh-152490: Fix TypeError when traceback.py formats SyntaxError(NotImplemented) (GH-152495)

Method traceback.TracebackException._format_syntax_error contains line `msg = self.msg or "<no detail available>"`.
Since 3.14, bool(NotImplemented) raises TypeError and hence so does `self.msg or ...`.  Catch it in a try statement.

---------
(cherry picked from commit 5503a5e)

Co-authored-by: Aniket <[email protected]>
Co-authored-by: Terry Jan Reedy <[email protected]>
Co-authored-by: Bénédikt Tran <[email protected]>
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.

3 participants