Skip to content
Closed
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
3 changes: 0 additions & 3 deletions Lib/test/test_bool.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
import os

class BoolTest(unittest.TestCase):

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_subclass(self):
try:
class C(bool):
Expand Down
7 changes: 6 additions & 1 deletion vm/src/builtins/int.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::{float, PyByteArray, PyBytes, PyStr, PyType, PyTypeRef};
use super::{float, PyBool, PyByteArray, PyBytes, PyStr, PyType, PyTypeRef};
use crate::{
builtins::PyStrRef,
bytesinner::PyBytesInner,
Expand Down Expand Up @@ -213,6 +213,11 @@ impl Constructor for PyInt {
type Args = IntOptions;

fn py_new(cls: PyTypeRef, options: Self::Args, vm: &VirtualMachine) -> PyResult {
if cls.is(PyBool::class(vm)) {
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
Expand Down