| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1285,8 +1285,6 @@ def check_overflow(self, lower, upper): | |||
| 1285 | 1285 | self.assertRaises(OverflowError, array.array, self.typecode, [upper+1]) | |
| 1286 | 1286 | self.assertRaises(OverflowError, a.__setitem__, 0, upper+1) | |
| 1287 | 1287 | ||
| 1288 | - # TODO: RUSTPYTHON | ||
| 1289 | - @unittest.expectedFailure | ||
| 1290 | 1288 | def test_subclassing(self): | |
| 1291 | 1289 | typecode = self.typecode | |
| 1292 | 1290 | class ExaggeratingArray(array.array): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -139,8 +139,6 @@ def test_entry_points_missing_name(self): | |||
| 139 | 139 | def test_entry_points_missing_group(self): | |
| 140 | 140 | assert entry_points(group='missing') == () | |
| 141 | 141 | ||
| 142 | - # TODO: RUSTPYTHON | ||
| 143 | - @unittest.expectedFailure | ||
| 144 | 142 | def test_entry_points_allows_no_attributes(self): | |
| 145 | 143 | ep = entry_points().select(group='entries', name='main') | |
| 146 | 144 | with self.assertRaises(AttributeError): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -242,8 +242,6 @@ class PropertySubSlots(property): | |||
| 242 | 242 | ||
| 243 | 243 | class PropertySubclassTests(unittest.TestCase): | |
| 244 | 244 | ||
| 245 | - # TODO: RUSTPYTHON | ||
| 246 | - @unittest.expectedFailure | ||
| 247 | 245 | def test_slots_docstring_copy_exception(self): | |
| 248 | 246 | try: | |
| 249 | 247 | class Foo(object): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1132,8 +1132,6 @@ class MyRef(weakref.ref): | |||
| 1132 | 1132 | self.assertIn(r1, refs) | |
| 1133 | 1133 | self.assertIn(r2, refs) | |
| 1134 | 1134 | ||
| 1135 | - # TODO: RUSTPYTHON | ||
| 1136 | - @unittest.expectedFailure | ||
| 1137 | 1135 | def test_subclass_refs_with_slots(self): | |
| 1138 | 1136 | class MyRef(weakref.ref): | |
| 1139 | 1137 | __slots__ = "slot1", "slot2" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1038,9 +1038,6 @@ impl Constructor for PyType { | |||
| 1038 | 1038 | }); | |
| 1039 | 1039 | } | |
| 1040 | 1040 | ||
| 1041 | - // TODO: Flags is currently initialized with HAS_DICT. Should be | ||
| 1042 | - // updated when __slots__ are supported (toggling the flag off if | ||
| 1043 | - // a class has __slots__ defined). | ||
| 1044 | 1041 | let heaptype_slots: Option<PyRef<PyTuple<PyStrRef>>> = | |
| 1045 | 1042 | if let Some(x) = attributes.get(identifier!(vm, __slots__)) { | |
| 1046 | 1043 | let slots = if x.class().is(vm.ctx.types.str_type) { | |
@@ -1072,7 +1069,12 @@ impl Constructor for PyType { | |||
| 1072 | 1069 | let heaptype_member_count = heaptype_slots.as_ref().map(|x| x.len()).unwrap_or(0); | |
| 1073 | 1070 | let member_count: usize = base_member_count + heaptype_member_count; | |
| 1074 | 1071 | ||
| 1075 | - let flags = PyTypeFlags::heap_type_flags() | PyTypeFlags::HAS_DICT; | ||
| 1072 | + let mut flags = PyTypeFlags::heap_type_flags(); | ||
| 1073 | + // Only add HAS_DICT and MANAGED_DICT if __slots__ is not defined. | ||
| 1074 | + if heaptype_slots.is_none() { | ||
| 1075 | + flags |= PyTypeFlags::HAS_DICT | PyTypeFlags::MANAGED_DICT; | ||
| 1076 | + } | ||
| 1077 | + | ||
| 1076 | 1078 | let (slots, heaptype_ext) = { | |
| 1077 | 1079 | let slots = PyTypeSlots { | |
| 1078 | 1080 | flags, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -122,6 +122,7 @@ bitflags! { | |||
| 122 | 122 | #[derive(Copy, Clone, Debug, PartialEq)] | |
| 123 | 123 | #[non_exhaustive] | |
| 124 | 124 | pub struct PyTypeFlags: u64 { | |
| 125 | + const MANAGED_DICT = 1 << 4; | ||
| 125 | 126 | const IMMUTABLETYPE = 1 << 8; | |
| 126 | 127 | const HEAPTYPE = 1 << 9; | |
| 127 | 128 | const BASETYPE = 1 << 10; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments