opened
coolreader18
username_0
I added a type check in `_PyErr_CreateException` as @username_2 suggested.

I'm not sure if I should replace the check in `do_raise` in `ceval.c` with a call to `_PyErr_CreateException`, as it's effectively the same functionality?

<!-- issue-number: bpo-39091 -->
https://bugs.python.org/issue39091
<!-- /issue-number -->
bpo-39091: Fix segfault when Exception constructor returns non-exception for gen.throw (and probably some other places)
issue
created
the-knights-who-say-ni
username_1
Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the [PSF contributor agreement](https://www.python.org/psf/contrib/contrib-form/) (CLA).



## CLA Missing

Our records indicate the following people have not signed the CLA:

@username_0

For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow [the steps outlined in the CPython devguide](https://devguide.python.org/pullrequest/#licensing) to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.


You can [check yourself](https://check-python-cla.herokuapp.com/) to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!
comment
created
serhiy-storchaka
username_2
`do_raise` has a complex code. Unless it contains similar bug I suggest to left refactoring to other issue.
comment
created
coolreader18
username_0
Any updates on this?
comment
created
bl-ue
username_3
ping @username_2 @username_5 this PR _needs_ to be merged.
comment
created
miss-islington
username_4
Thanks @username_0 for the PR, and @benjaminp for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.8, 3.9.
🐍🍒⛏🤖
comment
created
miss-islington
username_4
Sorry, @username_0 and @benjaminp, I could not cleanly backport this to `3.8` due to a conflict. 
                                Please backport using [cherry_picker](https://pypi.org/project/cherry-picker/) on command line.
                                ```
                                cherry_picker 83ca46b7784b7357d82ec47b33295e09ed7380cb 3.8
                                ```
comment
created
vstinner
username_5
Thanks for the fix!
comment
created
nocturn9x
username_6
Took 2 years but it's finally getting fixed! 😂
comment
created
vstinner
username_5
Better late than never.
comment