Skip to content

Commit be6ea2a

Browse files
hydrogen602youknowone
authored andcommitted
fix for test test_bool.BoolTest.test_subclass
1 parent 4a93914 commit be6ea2a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Lib/test/test_bool.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
class BoolTest(unittest.TestCase):
99

10-
# TODO: RUSTPYTHON
11-
@unittest.expectedFailure
1210
def test_subclass(self):
1311
try:
1412
class C(bool):

vm/src/builtins/int.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,12 @@ impl Constructor for PyInt {
212212
type Args = IntOptions;
213213

214214
fn py_new(cls: PyTypeRef, options: Self::Args, vm: &VirtualMachine) -> PyResult {
215+
if cls.is(vm.ctx.types.bool_type) {
216+
return Err(
217+
vm.new_type_error("int.__new__(bool) is not safe, use bool.__new__()".to_owned())
218+
);
219+
}
220+
215221
let value = if let OptionalArg::Present(val) = options.val_options {
216222
if let OptionalArg::Present(base) = options.base {
217223
let base = base

0 commit comments

Comments
 (0)