@@ -3416,33 +3416,6 @@ class C:
34163416 c = C ('hello' )
34173417 self .assertEqual (deepcopy (c ), c )
34183418
3419- def test_slotted_set_del_attr_reference_new_class_via__class__ (self ):
3420- # See https://github.com/python/cpython/pull/144021
3421- @dataclass (frozen = True , slots = True )
3422- class SetDelAttrTest :
3423- pass
3424-
3425- for method_name in ('__setattr__' , '__delattr__' ):
3426- with self .subTest (method_name = method_name ):
3427- method = getattr (SetDelAttrTest , method_name )
3428- cell_idx = method .__code__ .co_freevars .index ('__class__' )
3429- reference = method .__closure__ [cell_idx ].cell_contents
3430- self .assertIs (reference , SetDelAttrTest )
3431-
3432- def test_slotted_set_del_attr_do_not_reference_old_class (self ):
3433- # See https://github.com/python/cpython/pull/144021
3434- class SetDelAttrTest :
3435- pass
3436-
3437- OriginalCls = SetDelAttrTest
3438- SetDelAttrTest = dataclass (frozen = True , slots = True )(SetDelAttrTest )
3439-
3440- for method_name in ('__setattr__' , '__delattr__' ):
3441- with self .subTest (method_name = method_name ):
3442- method = getattr (SetDelAttrTest , method_name )
3443- cell_contents = [cell .cell_contents for cell in method .__closure__ ]
3444- self .assertNotIn (OriginalCls , cell_contents )
3445-
34463419
34473420class TestSlots (unittest .TestCase ):
34483421 def test_simple (self ):
0 commit comments