-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
_PyErr_CreateException() must check that the result is an exception (CPython Segfault in 5 lines of code) #83272
Comments
The following lines trigger a segmentation fault: class E(BaseException):
def __new__(cls, *args, **kwargs):
return cls
def a(): yield
a().throw(E) Source with a bit more explanation: https://gist.github.com/coolreader18/6dbe0be2ae2192e90e1a809f1624c694 (I'm not the author of that gist, just reporting it here). |
I can reproduce the issue on master: >>> class E(BaseException):
... def __new__(cls, *args, **kwargs):
... return cls
...
>>> def a(): yield
...
>>> a().throw(E) Program received signal SIGSEGV, Segmentation fault. |
Good catch! Since you already investigated the code, do you mind to create a PR which fixes a crash? I think that adding PyExceptionInstance_Check() in _PyErr_CreateException() could fix the issue. |
I'm not sure if this will actually appear as a message (I just registered for the bug tracker and I'm not sure how it works), but I wrote the gist and I can definitely make a PR. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: