Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add HAS_WEAKREF to array, deque, _grouper; remove expectedFailure mar…
…kers

- 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
  • Loading branch information
youknowone committed Mar 5, 2026
commit 2ee043e50287f15703de2345c10bdfe8a7dfc293
6 changes: 0 additions & 6 deletions Lib/test/test_dataclasses/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3672,7 +3672,6 @@ class A:
self.assertEqual(obj.a, 'a')
self.assertEqual(obj.b, 'b')

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_slots_no_weakref(self):
@dataclass(slots=True)
class A:
Expand All @@ -3687,7 +3686,6 @@ class A:
with self.assertRaises(AttributeError):
a.__weakref__

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_slots_weakref(self):
@dataclass(slots=True, weakref_slot=True)
class A:
Expand Down Expand Up @@ -3748,7 +3746,6 @@ def test_weakref_slot_make_dataclass(self):
"weakref_slot is True but slots is False"):
B = make_dataclass('B', [('a', int),], weakref_slot=True)

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_weakref_slot_subclass_weakref_slot(self):
@dataclass(slots=True, weakref_slot=True)
class Base:
Expand All @@ -3767,7 +3764,6 @@ class A(Base):
a_ref = weakref.ref(a)
self.assertIs(a.__weakref__, a_ref)

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_weakref_slot_subclass_no_weakref_slot(self):
@dataclass(slots=True, weakref_slot=True)
class Base:
Expand All @@ -3785,7 +3781,6 @@ class A(Base):
a_ref = weakref.ref(a)
self.assertIs(a.__weakref__, a_ref)

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_weakref_slot_normal_base_weakref_slot(self):
class Base:
__slots__ = ('__weakref__',)
Expand Down Expand Up @@ -3830,7 +3825,6 @@ class B[T2]:
self.assertTrue(B.__weakref__)
B()

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_dataclass_derived_generic_from_base(self):
T = typing.TypeVar('T')

Expand Down
2 changes: 1 addition & 1 deletion crates/stdlib/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ mod array {
}

#[pyclass(
flags(BASETYPE),
flags(BASETYPE, HAS_WEAKREF),
with(
Comparable,
AsBuffer,
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/stdlib/collections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ mod _collections {
}

#[pyclass(
flags(BASETYPE),
flags(BASETYPE, HAS_WEAKREF),
with(
Constructor,
Initializer,
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/stdlib/itertools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ mod decl {
groupby: PyRef<PyItertoolsGroupBy>,
}

#[pyclass(with(IterNext, Iterable))]
#[pyclass(with(IterNext, Iterable), flags(HAS_WEAKREF))]
impl PyItertoolsGrouper {}

impl SelfIter for PyItertoolsGrouper {}
Expand Down