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

ENH: future-proof changing signature in format() and format_exception_only() #133

Open
1 task done
mattip opened this issue Aug 18, 2024 · 2 comments · May be fixed by #135
Open
1 task done

ENH: future-proof changing signature in format() and format_exception_only() #133

mattip opened this issue Aug 18, 2024 · 2 comments · May be fixed by #135
Labels
enhancement New feature or request

Comments

@mattip
Copy link

mattip commented Aug 18, 2024

Things to check first

  • I have searched the existing issues and didn't find my feature already requested there

Feature description

Currently, PatchedTracebackException overrides the stdlib TracebackException implementation of format and format_exception_only. With the new pyrepl coming in python3.13, the signatures of those methods changes: they get an additional kwarg colorize. In PyPy we would like to backport that pure-python pyrepl to our python3.10 implementation, but then the overrides' signatures are wrong. Adding **kwargs would future-proof the overrides, at the cost of loosing the nice colorization of tracebacks.

Use case

This came up in pypy/pypy#5004, where pytest collection suddenly started failing. There may be other cases for using exceptiongroups on Python implementations and versions that change the signatures of the overriden functions.

@mattip mattip added the enhancement New feature or request label Aug 18, 2024
@agronholm
Copy link
Owner

Hm, I looked at the signatures of the stdlib counterparts and, to my surprise, they too had **kwargs there. I'm working on a PR to address this, but I'm getting test failures to do the exception note being present in the output twice. I'll post the PR as soon as I've resolved this.

agronholm added a commit that referenced this issue Sep 9, 2024
This changes the signatures to match their standard library counterparts.

Fixes #133.
@agronholm
Copy link
Owner

Ok, that was just the result of a wrong key combination somewhere down the line which duplicate a yield statement. Fixed. The PR is up for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants