Commit ed16eff5 authored by Stefan Krah's avatar Stefan Krah

Issue #16431: Also fix the opposite direction.

parent f4abc7b8
......@@ -2052,6 +2052,10 @@ class UsabilityTest(unittest.TestCase):
self.assertIs(type(b), MyDecimal)
self.assertEqual(a, b)
c = Decimal(b)
self.assertIs(type(c), Decimal)
self.assertEqual(a, c)
def test_implicit_context(self):
Decimal = self.decimal.Decimal
getcontext = self.decimal.getcontext
......
......@@ -2345,7 +2345,7 @@ PyDecType_FromDecimalExact(PyTypeObject *type, PyObject *v, PyObject *context)
PyObject *dec;
uint32_t status = 0;
if (type == &PyDec_Type) {
if (type == Py_TYPE(v)) {
Py_INCREF(v);
return v;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment