forked from Rust-related/RustPython
fix for test test_bool.BoolTest.test_subclass
This commit is contained in:
committed by
Jeong, YunWon
parent
4a939141f6
commit
be6ea2a7b8
2
Lib/test/test_bool.py
vendored
2
Lib/test/test_bool.py
vendored
@@ -7,8 +7,6 @@ import os
|
||||
|
||||
class BoolTest(unittest.TestCase):
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_subclass(self):
|
||||
try:
|
||||
class C(bool):
|
||||
|
||||
@@ -212,6 +212,12 @@ impl Constructor for PyInt {
|
||||
type Args = IntOptions;
|
||||
|
||||
fn py_new(cls: PyTypeRef, options: Self::Args, vm: &VirtualMachine) -> PyResult {
|
||||
if cls.is(vm.ctx.types.bool_type) {
|
||||
return Err(
|
||||
vm.new_type_error("int.__new__(bool) is not safe, use bool.__new__()".to_owned())
|
||||
);
|
||||
}
|
||||
|
||||
let value = if let OptionalArg::Present(val) = options.val_options {
|
||||
if let OptionalArg::Present(base) = options.base {
|
||||
let base = base
|
||||
|
||||
Reference in New Issue
Block a user