Skip to content

Commit 7fa9b14

Browse files
committed
Issue #8627: Fix "XXX undetected error" from unchecked PyErr_WarnPy3k return.
This is just a quick fix: if the warning is turned into an exception, the exception simply gets ignored.
1 parent e116e73 commit 7fa9b14

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

Misc/NEWS

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ Core and Builtins
1313
-----------------
1414

1515
- Issue #8627: Remove bogus "Overriding __cmp__ blocks inheritance of
16-
__hash__ in 3.x" warning.
16+
__hash__ in 3.x" warning. Also fix "XXX undetected error" that
17+
arises from the "Overriding __eq__ blocks inheritance ..." warning
18+
when turned into an exception: in this case the exception simply
19+
gets ignored.
1720

1821
- Issue #8748: Fix two issues with comparisons between complex and integer
1922
objects. (1) The comparison could incorrectly return True in some cases

Objects/typeobject.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3869,10 +3869,16 @@ inherit_slots(PyTypeObject *type, PyTypeObject *base)
38693869
(base->tp_hash != PyObject_HashNotImplemented) &&
38703870
!OVERRIDES_HASH(type)) {
38713871
if (OVERRIDES_EQ(type)) {
3872-
PyErr_WarnPy3k("Overriding "
3873-
"__eq__ blocks inheritance "
3874-
"of __hash__ in 3.x",
3875-
1);
3872+
if (PyErr_WarnPy3k("Overriding "
3873+
"__eq__ blocks inheritance "
3874+
"of __hash__ in 3.x",
3875+
1) < 0)
3876+
/* XXX This isn't right. If the warning is turned
3877+
into an exception, we should be communicating
3878+
the error back to the caller, but figuring out
3879+
how to clean-up in that case is tricky. See
3880+
issue 8627 for more. */
3881+
PyErr_Clear();
38763882
}
38773883
}
38783884
}

0 commit comments

Comments
 (0)