Skip to content

Commit c99a5ae

Browse files
committed
Add HAS_WEAKREF to array, deque, _grouper; remove expectedFailure markers
- Add HAS_WEAKREF to PyArray and PyDeque (matches CPython) - Add HAS_WEAKREF to PyItertoolsGrouper (internal use by groupby) - Remove 6 expectedFailure markers from test_dataclasses for weakref/slots tests that now pass
1 parent eb96090 commit c99a5ae

File tree

4 files changed

+3
-9
lines changed

4 files changed

+3
-9
lines changed

Lib/test/test_dataclasses/__init__.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3672,7 +3672,6 @@ class A:
36723672
self.assertEqual(obj.a, 'a')
36733673
self.assertEqual(obj.b, 'b')
36743674

3675-
@unittest.expectedFailure # TODO: RUSTPYTHON
36763675
def test_slots_no_weakref(self):
36773676
@dataclass(slots=True)
36783677
class A:
@@ -3687,7 +3686,6 @@ class A:
36873686
with self.assertRaises(AttributeError):
36883687
a.__weakref__
36893688

3690-
@unittest.expectedFailure # TODO: RUSTPYTHON
36913689
def test_slots_weakref(self):
36923690
@dataclass(slots=True, weakref_slot=True)
36933691
class A:
@@ -3748,7 +3746,6 @@ def test_weakref_slot_make_dataclass(self):
37483746
"weakref_slot is True but slots is False"):
37493747
B = make_dataclass('B', [('a', int),], weakref_slot=True)
37503748

3751-
@unittest.expectedFailure # TODO: RUSTPYTHON
37523749
def test_weakref_slot_subclass_weakref_slot(self):
37533750
@dataclass(slots=True, weakref_slot=True)
37543751
class Base:
@@ -3767,7 +3764,6 @@ class A(Base):
37673764
a_ref = weakref.ref(a)
37683765
self.assertIs(a.__weakref__, a_ref)
37693766

3770-
@unittest.expectedFailure # TODO: RUSTPYTHON
37713767
def test_weakref_slot_subclass_no_weakref_slot(self):
37723768
@dataclass(slots=True, weakref_slot=True)
37733769
class Base:
@@ -3785,7 +3781,6 @@ class A(Base):
37853781
a_ref = weakref.ref(a)
37863782
self.assertIs(a.__weakref__, a_ref)
37873783

3788-
@unittest.expectedFailure # TODO: RUSTPYTHON
37893784
def test_weakref_slot_normal_base_weakref_slot(self):
37903785
class Base:
37913786
__slots__ = ('__weakref__',)
@@ -3830,7 +3825,6 @@ class B[T2]:
38303825
self.assertTrue(B.__weakref__)
38313826
B()
38323827

3833-
@unittest.expectedFailure # TODO: RUSTPYTHON
38343828
def test_dataclass_derived_generic_from_base(self):
38353829
T = typing.TypeVar('T')
38363830

crates/stdlib/src/array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ mod array {
698698
}
699699

700700
#[pyclass(
701-
flags(BASETYPE),
701+
flags(BASETYPE, HAS_WEAKREF),
702702
with(
703703
Comparable,
704704
AsBuffer,

crates/vm/src/stdlib/collections.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ mod _collections {
5656
}
5757

5858
#[pyclass(
59-
flags(BASETYPE),
59+
flags(BASETYPE, HAS_WEAKREF),
6060
with(
6161
Constructor,
6262
Initializer,

crates/vm/src/stdlib/itertools.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ mod decl {
667667
groupby: PyRef<PyItertoolsGroupBy>,
668668
}
669669

670-
#[pyclass(with(IterNext, Iterable))]
670+
#[pyclass(with(IterNext, Iterable), flags(HAS_WEAKREF))]
671671
impl PyItertoolsGrouper {}
672672

673673
impl SelfIter for PyItertoolsGrouper {}

0 commit comments

Comments
 (0)