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

test_traceback's PurePythonExceptionFormattingMixin does not fail correctly #125514

Closed
iritkatriel opened this issue Oct 15, 2024 · 0 comments · Fixed by #125516
Closed

test_traceback's PurePythonExceptionFormattingMixin does not fail correctly #125514

iritkatriel opened this issue Oct 15, 2024 · 0 comments · Fixed by #125516
Labels
3.12 bugs and security fixes 3.13 bugs and security fixes 3.14 new features, bugs and security fixes

Comments

@iritkatriel
Copy link
Member

iritkatriel commented Oct 15, 2024

class PurePythonExceptionFormattingMixin:
    def get_exception(self, callable, slice_start=0, slice_end=-1):
        try:
            callable()    
            self.fail("No exception thrown.")
        except:
            return traceback.format_exc().splitlines()[slice_start:slice_end]

self.fail simply raises an exception, so putting it in a try..except is not going to work.

Linked PRs

iritkatriel added a commit to iritkatriel/cpython that referenced this issue Oct 15, 2024
@iritkatriel iritkatriel added needs backport to 3.12 bug and security fixes needs backport to 3.13 bugs and security fixes labels Oct 15, 2024
@Eclips4 Eclips4 added 3.12 bugs and security fixes 3.13 bugs and security fixes 3.14 new features, bugs and security fixes and removed needs backport to 3.12 bug and security fixes needs backport to 3.13 bugs and security fixes labels Oct 15, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Oct 15, 2024
… types in except: clauses (pythonGH-125516)

(cherry picked from commit 55c4f4c)

Co-authored-by: Irit Katriel <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Oct 15, 2024
… types in except: clauses (pythonGH-125516)

(cherry picked from commit 55c4f4c)

Co-authored-by: Irit Katriel <[email protected]>
iritkatriel added a commit that referenced this issue Oct 15, 2024
…n types in except: clauses (GH-125516) (#125525)

gh-125514: fix bug in test_traceback utility. Specify exception types in except: clauses (GH-125516)
(cherry picked from commit 55c4f4c)

Co-authored-by: Irit Katriel <[email protected]>
iritkatriel added a commit that referenced this issue Oct 15, 2024
…n types in except: clauses (GH-125516) (#125524)

gh-125514: fix bug in test_traceback utility. Specify exception types in except: clauses (GH-125516)
(cherry picked from commit 55c4f4c)

Co-authored-by: Irit Katriel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 bugs and security fixes 3.13 bugs and security fixes 3.14 new features, bugs and security fixes
Projects
None yet
2 participants