From 712ebf4b2ecd07e737be26637c31576aa408378f Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sun, 24 Nov 2019 00:24:57 +0000 Subject: [PATCH] mp.c: Use implicit-conversion rules in `coerce'. Coercion is only used (in `Py_TPFLAGS_CHECKTYPES' classes) in the three- way comparison function; but that's still relevant in Python 2. --- mp.c | 2 +- t/t-convert.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mp.c b/mp.c index c47b011..163e690 100644 --- a/mp.c +++ b/mp.c @@ -546,7 +546,7 @@ static PyObject *mp_pyfloat(PyObject *x) Py_INCREF(*x); Py_INCREF(*y); \ return (0); \ } \ - if ((z = tomp(*y)) != 0) { \ + if ((z = implicit##pre(*y)) != 0) { \ Py_INCREF(*x); \ *y = pre##_pywrap(z); \ return (0); \ diff --git a/t/t-convert.py b/t/t-convert.py index df80617..a5f7ff0 100644 --- a/t/t-convert.py +++ b/t/t-convert.py @@ -91,6 +91,8 @@ class TestConvert (U.TestCase): ## `MP' and `GF'. me.assertEqual(C.MP(5), 5) me.assertEqual(5, C.MP(5)) + me.assertNotEqual(C.MP(5), C.GF(5)) + me.assertNotEqual(C.GF(5), C.MP(5)) me.assertEqual(C.MP(5) + 3, 8) me.assertEqual(3 + C.MP(5), 8) -- 2.11.0