Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ def sub_bool_local():
assert math.copysign(1.0, right.imag) == -1.0


def test_pow_modulo_converts_operands_first():
assert_raises(TypeError, pow, 1, int, 1j)
assert_raises(TypeError, pow, 1j, set(), 3)
assert_raises(ValueError, pow, 1j, 2, 3)
assert_raises(ValueError, pow, 1, 2, 1j)


def test_div():
c2 = 2+2j
assert (c2 / 2) == complex(1, 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,12 @@ static Object doGeneric(Object leftObj, Object rightObj, @SuppressWarnings("unus
@InliningCutoff
@SuppressWarnings("unused")
static Object error(Object left, Object right, Object mod,
@Bind Node inliningTarget) {
@Bind Node inliningTarget,
@Exclusive @Cached ToComplexValueNode toComplexLeft,
@Exclusive @Cached ToComplexValueNode toComplexRight) {
if (toComplexLeft.execute(inliningTarget, left) == null || toComplexRight.execute(inliningTarget, right) == null) {
return PNotImplemented.NOT_IMPLEMENTED;
}
throw PRaiseNode.raiseStatic(inliningTarget, ValueError, ErrorMessages.COMPLEX_MODULO);
}

Expand Down