From 20bda581e3f95a8fa9057a7d63f09d00b4e425cc Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 18 Mar 2008 03:15:05 +0000 Subject: [PATCH] Clean up the Py3k warnings for non-BaseException-subclasses a bit. We now don't warn for some corner cases that deserve a warning, rather than warning double or incorrectly for some other corner cases. --- Python/ceval.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 72da2639920..d66d97e56bc 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4086,8 +4086,9 @@ cmp_outcome(int op, register PyObject *v, register PyObject *w) if (ret_val == -1) return NULL; } - if (Py_Py3kWarningFlag && - !Py3kExceptionClass_Check(exc)) + else if (Py_Py3kWarningFlag && + !PyTuple_Check(exc) && + !Py3kExceptionClass_Check(exc)) { int ret_val; ret_val = PyErr_WarnEx( @@ -4108,8 +4109,9 @@ cmp_outcome(int op, register PyObject *v, register PyObject *w) if (ret_val == -1) return NULL; } - if (Py_Py3kWarningFlag && - !Py3kExceptionClass_Check(w)) + else if (Py_Py3kWarningFlag && + !PyTuple_Check(w) && + !Py3kExceptionClass_Check(w)) { int ret_val; ret_val = PyErr_WarnEx(