Skip to content

Commit ed032d3

Browse files
authored
Make singleton builtin types immutable (#7423)
1 parent 4483c31 commit ed032d3

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

Lib/test/test_builtin.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2434,7 +2434,6 @@ def test_bool_notimplemented(self):
24342434
with self.assertRaisesRegex(TypeError, msg):
24352435
not NotImplemented
24362436

2437-
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: TypeError not raised
24382437
def test_singleton_attribute_access(self):
24392438
for singleton in (NotImplemented, Ellipsis):
24402439
with self.subTest(singleton):

crates/vm/src/builtins/singletons.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl Constructor for PyNotImplemented {
9898
}
9999
}
100100

101-
#[pyclass(with(Constructor, AsNumber, Representable))]
101+
#[pyclass(with(Constructor, AsNumber, Representable), flags(IMMUTABLETYPE))]
102102
impl PyNotImplemented {
103103
#[pymethod]
104104
fn __reduce__(&self, vm: &VirtualMachine) -> PyStrRef {

crates/vm/src/builtins/slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ impl Constructor for PyEllipsis {
393393
}
394394
}
395395

396-
#[pyclass(with(Constructor, Representable))]
396+
#[pyclass(with(Constructor, Representable), flags(IMMUTABLETYPE))]
397397
impl PyEllipsis {
398398
#[pymethod]
399399
fn __reduce__(&self, vm: &VirtualMachine) -> PyStrRef {

0 commit comments

Comments
 (0)