bool.real

This commit is contained in:
Jeong YunWon committed 2019-08-22 13:57:44 +09:00
1 parent 2dab55864c
commit 0327428aa5
3 files changed
+8 -3

No files matched your search

+5
View File
@@ -80,6 +80,11 @@ assert False.__xor__(False) is False
assert False.__rxor__(0) is not False
assert False.__rxor__(False) is False
assert True.real == 1
assert True.imag == 0
assert type(True.real) is int
assert type(True.imag) is int
# Check work for sequence and map
assert bool({}) is False
assert bool([]) is False
+1 -1
View File
@@ -77,7 +77,7 @@ The class bool is a subclass of the class int, and cannot be subclassed.";
"__rand__" => context.new_rustfunc(bool_rand),
"__xor__" => context.new_rustfunc(bool_xor),
"__rxor__" => context.new_rustfunc(bool_rxor),
"__doc__" => context.new_str(bool_doc.to_string())
"__doc__" => context.new_str(bool_doc.to_string()),
});
}
+2 -2
View File
@@ -681,8 +681,8 @@ impl PyInt {
Ok(PyBytes::new(bytes))
}
#[pyproperty]
fn real(zelf: PyRef<Self>, _vm: &VirtualMachine) -> PyIntRef {
zelf
fn real(&self, vm: &VirtualMachine) -> PyObjectRef {
vm.ctx.new_int(self.value.clone())
}
#[pyproperty]