diff Objects/typeobject.c @ 62101:67c33cb9622d legacy-trunk

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.
author Mark Dickinson <dickinsm@gmail.com>
date Sat, 05 Jun 2010 12:14:43 +0000
parents 8fa4a5e5af55
children 3721d4e5b2ee
line wrap: on
line diff
--- a/Objects/typeobject.c	Sat Jun 05 12:10:52 2010 +0000
+++ b/Objects/typeobject.c	Sat Jun 05 12:14:43 2010 +0000
@@ -3869,10 +3869,16 @@
                                 (base->tp_hash != PyObject_HashNotImplemented) &&
                                 !OVERRIDES_HASH(type)) {
                     if (OVERRIDES_EQ(type)) {
-                        PyErr_WarnPy3k("Overriding "
-                          "__eq__ blocks inheritance "
-                          "of __hash__ in 3.x",
-                          1);
+                        if (PyErr_WarnPy3k("Overriding "
+                                           "__eq__ blocks inheritance "
+                                           "of __hash__ in 3.x",
+                                           1) < 0)
+                            /* XXX This isn't right.  If the warning is turned
+                               into an exception, we should be communicating
+                               the error back to the caller, but figuring out
+                               how to clean-up in that case is tricky.  See
+                               issue 8627 for more. */
+                            PyErr_Clear();
                     }
                 }
             }