bpo-44232: Fix type_new() error reporting#26359
Conversation
There was a problem hiding this comment.
I'm not sure if it's worth mentioning in the blurb that this bug only affected people using debug builds. Release build users shouldnt have noticed anything.
There was a problem hiding this comment.
I think we should mention it as people use debug build outside Cpython development quite a lot
There was a problem hiding this comment.
I didn't expect anyone to use a Python debug build until I saw https://bugs.python.org/issue44232
IMO it's worth it to document the bugfix since it impacts Django, but likely many more projects.
There was a problem hiding this comment.
Wow I need to stop sending messages late at night ;-). I'm really sorry this concern got lost in translation. I wasn't suggesting we get rid of the blurb. I was suggesting we add a line somewhere that says this only affects debug builds and not release ones. Previously I did that for another AssertionError crash in 3.9 - 3.10 because I was afraid people would read the blurb and think their Python is affected.
Anyways, I think it's fine if you dont want to. Thanks for fixing this :).
There was a problem hiding this comment.
Ah ok. Well, the change is now merged, I'm fine with the merged NEWS entry :-)
There was a problem hiding this comment.
Small nit, feel free to ignore
| if (*type == NULL) { | |
| return -1; | |
| } | |
| return 1; | |
| return *type == NULL ? -1 : 1; |
There was a problem hiding this comment.
I prefer to "handle errors explicitly". Well, it's just a personal coding style preference.
|
@vstinner Thanks 👍 I can confirm that this patch works for us. |
Fix a regression in type() when a metaclass raises an exception. The C function type_new() must properly report the exception when a metaclass constructor raises an exception and the winner class is not the metaclass.
|
macOS: test_ssl failed, unrelated to the PR: https://bugs.python.org/issue44237 |
|
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10. |
|
GH-26365 is a backport of this pull request to the 3.10 branch. |
Fix a regression in type() when a metaclass raises an exception. The C function type_new() must properly report the exception when a metaclass constructor raises an exception and the winner class is not the metaclass. (cherry picked from commit bd199e7) Co-authored-by: Victor Stinner <vstinner@python.org>
Fix a regression in type() when a metaclass raises an exception. The C function type_new() must properly report the exception when a metaclass constructor raises an exception and the winner class is not the metaclass. (cherry picked from commit bd199e7) Co-authored-by: Victor Stinner <vstinner@python.org>
Fix a regression in type() when a metaclass raises an exception. The
C function type_new() must properly report the exception when a
metaclass constructor raises an exception and the winner class is not
the metaclass.
https://bugs.python.org/issue44232