Skip to content

Conversation

@Eclips4
Copy link
Member

@Eclips4Eclips4 commented Mar 4, 2024

Copy link
Member

@serhiy-storchakaserhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops!

Copy link
Member

@JelleZijlstraJelleZijlstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Seems like this only affects the error message that gets thrown if a __pos__ method returns NULL without an exception or non-NULL with an exception, which can only happen with a poorly written C extension that overrides this slot. You can see it with this patch:

diff --git a/Objects/complexobject.c b/Objects/complexobject.c index d8b0e84da5..b374c564af 100644 --- a/Objects/complexobject.c +++ b/Objects/complexobject.c @@ -577,6 +577,7 @@ complex_neg(PyComplexObject *v) static PyObject * complex_pos(PyComplexObject *v){+ return NULL; if (PyComplex_CheckExact(v)){return Py_NewRef(v)} 
Python 3.13.0a4+ (heads/pep696v2-dirty:a265008fa5, Mar 4 2024, 09:31:12) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> +1j Fatal Python error: _Py_CheckSlotResult: Slot __pow__ of type complex failed without setting an exception Python runtime state: initialized Current thread 0x00000001f12f9e00 (most recent call first): <no Python frame> zsh: abort ./python.exe 

@JelleZijlstraJelleZijlstra added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Mar 4, 2024
@Eclips4
Copy link
MemberAuthor

Eclips4 commented Mar 4, 2024

Jelle, there's no need in backports :)
#112145 (which introduce the problem) wasn't backported to 3.12 and 3.11 branches.

@Eclips4Eclips4 removed needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Mar 4, 2024
@JelleZijlstra
Copy link
Member

Thanks, didn't realize this code changed recently.

@serhiy-storchakaserhiy-storchaka merged commit 8a84eb7 into python:mainMar 4, 2024
@Eclips4Eclips4 deleted the issue-116316 branch March 4, 2024 18:03
woodruffw pushed a commit to woodruffw-forks/cpython that referenced this pull request Mar 4, 2024
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 25, 2024
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@Eclips4@JelleZijlstra@serhiy-storchaka