We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eebdbfe commit 490db0aCopy full SHA for 490db0a
vm/src/obj/objcomplex.rs
@@ -67,7 +67,9 @@ impl PyComplexRef {
67
}
68
69
fn to_complex(value: PyObjectRef, vm: &VirtualMachine) -> PyResult<Option<Complex64>> {
70
- if objtype::isinstance(&value, &vm.ctx.int_type()) {
+ if objtype::isinstance(&value, &vm.ctx.complex_type()) {
71
+ Ok(Some(get_value(&value)))
72
+ } else if objtype::isinstance(&value, &vm.ctx.int_type()) {
73
match objint::get_value(&value).to_f64() {
74
Some(v) => Ok(Some(Complex64::new(v, 0.0))),
75
None => Err(vm.new_overflow_error("int too large to convert to float".to_string())),
0 commit comments