Skip to content

Commit c36138c

Browse files
committed
fix enum
1 parent 9b2ad34 commit c36138c

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Lib/test/test_signal.py

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

2525
class GenericTests(unittest.TestCase):
2626

27-
# TODO: RUSTPYTHON
28-
@unittest.expectedFailure
2927
def test_enums(self):
3028
for name in dir(signal):
3129
sig = getattr(signal, name)

crates/vm/src/builtins/type.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1499,9 +1499,15 @@ impl Constructor for PyType {
14991499
// Only add if:
15001500
// 1. base is not type (type subclasses inherit __dict__ from type)
15011501
// 2. the class has HAS_DICT flag (i.e., __slots__ was not defined or __dict__ is in __slots__)
1502+
// 3. no base class in MRO already provides __dict__ descriptor
15021503
if !base_is_type && typ.slots.flags.has_feature(PyTypeFlags::HAS_DICT) {
15031504
let __dict__ = identifier!(vm, __dict__);
1504-
if !typ.attributes.read().contains_key(&__dict__) {
1505+
let has_inherited_dict = typ
1506+
.mro
1507+
.read()
1508+
.iter()
1509+
.any(|base| base.attributes.read().contains_key(&__dict__));
1510+
if !typ.attributes.read().contains_key(&__dict__) && !has_inherited_dict {
15051511
unsafe {
15061512
let descriptor =
15071513
vm.ctx

0 commit comments

Comments
 (0)