def assertWarning(self, _, warning, expected_message):
self.assertEqual(str(warning.message), expected_message)
+ def assertNoWarning(self, _, recorder):
+ self.assertEqual(len(recorder.warnings), 0)
+
def test_backquote(self):
expected = 'backquote not supported in 3.x; use repr()'
with check_warnings() as w:
def test_builtin_function_or_method_comparisons(self):
expected = ('builtin_function_or_method '
- 'inequality comparisons not supported in 3.x')
+ 'order comparisons not supported in 3.x')
func = eval
meth = {}.get
with check_warnings() as w:
self.assertWarning(meth <= func, w, expected)
w.reset()
self.assertWarning(meth >= func, w, expected)
+ w.reset()
+ self.assertNoWarning(meth == func, w)
+ self.assertNoWarning(meth != func, w)
+ lam = lambda x: x
+ self.assertNoWarning(lam == func, w)
+ self.assertNoWarning(lam != func, w)
def test_sort_cmp_arg(self):
expected = "the cmp argument is not supported in 3.x"
- Issue #4547: When debugging a very large function, it was not always
possible to update the lineno attribute of the current frame.
+- Issue #6119: Fixed a incorrect Py3k warning about order comparisons of builtin
+ functions and methods.
+
- Issue #5330: C functions called with keyword arguments were not reported by
the various profiling modules (profile, cProfile). Patch by Hagen F�rstenau.
PyObject *res;
int eq;
- if ((op != Py_EQ && op != Py_NE) ||
- !PyCFunction_Check(self) ||
- !PyCFunction_Check(other))
- {
- /* Py3K warning if types are not equal and comparison isn't == or != */
- if (PyErr_WarnPy3k("builtin_function_or_method inequality "
+ if (op != Py_EQ && op != Py_NE) {
+ /* Py3K warning if comparison isn't == or !=. */
+ if (PyErr_WarnPy3k("builtin_function_or_method order "
"comparisons not supported in 3.x", 1) < 0) {
return NULL;
}
Py_INCREF(Py_NotImplemented);
return Py_NotImplemented;
}
+ else if (!PyCFunction_Check(self) || !PyCFunction_Check(other)) {
+ Py_INCREF(Py_NotImplemented);
+ return Py_NotImplemented;
+ }
a = (PyCFunctionObject *)self;
b = (PyCFunctionObject *)other;
eq = a->m_self == b->m_self;