Commit dc0c3422 authored by Boxiang Sun's avatar Boxiang Sun

loose the type check in complexDivFloat

complexTruediv will pass subtype of float to complexDivFloat,
so loose the type check in complexDivFloat, use PyFloat_Check
instead check the type exactly.
parent 6c6e8882
......@@ -220,7 +220,7 @@ extern "C" Box* complexDivFloat(BoxedComplex* lhs, BoxedFloat* rhs) {
if (!PyComplex_Check(lhs))
raiseExcHelper(TypeError, "descriptor '__div__' requires a 'complex' object but received a '%s'",
getTypeName(lhs));
assert(rhs->cls == float_cls);
assert(PyFloat_Check(rhs));
if (rhs->d == 0.0) {
raiseDivZeroExc();
}
......
......@@ -68,3 +68,9 @@ for x in data:
arg2=y)))
except Exception as e:
print(e.message)
class F(float):
pass
print(1j.__truediv__(F(1)))
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