-
Notifications
You must be signed in to change notification settings - Fork 20
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
exceptiongroup monkeypatching traceback.TracebackException.__init__ breaks PyPy's Name/AttributeError suggestions #41
Comments
ah, I just realized that using |
This problem is unique to this project. It gave me no joy to duplicate the entire
No, I didn't know that. I thought I had duplicated all of the functionality of the initializer. Does PyPY need a special code path? Either way I'm open to a PR that fixes this. |
No, the problem is that in 3.10 there is no way to get those suggestions using the traceback module. The C logic for exception formatting has more features than |
I could give this approach a try and we see how annoying it is. It would fix the problem both on cpy 3.10 and on pypy. |
otherwise NameError/AttributeError suggestions break when using exceptiongroup on 3.10 (and on PyPy)
PyPy implements CPython 3.10's "Did you mean" suggestions for
NameError
andAttributeError
. We backported this feature to 3.9, and it is implemented in normal Python code in thetraceback
module. In CPython, the suggestions are implemented inPyErr_Display
in C, buttraceback
will also get an implementation in 3.12: python/cpython#97008At some point between versions 1.0.0rc9 and 1.0.2, the monkeypatching of
exceptiongroup
started breaking this feature:Git bisect points to a0ec8cc. The reason for the breackage is that PyPy's
TracebackException.__init__
has another check forNameError
/AttributeError
, just after the special case forSyntaxError
:I know that the monkeypatching can be turned off, but I wasn't even using
exceptiongroup
myself, onlyhypothesis
which does.I'm open to working on a fix, but would need some pointers on how you would want to do this. Ultimately the
traceback
module is to blame here, in my opinion, because it does not really have any useful ways to extend its functionality without copying large parts of it outright./cc @mattip
The text was updated successfully, but these errors were encountered: