(self)
| 1624 | @cpython_only |
| 1625 | @requires_specialization |
| 1626 | def test_store_attr_slot(self): |
| 1627 | class C: |
| 1628 | __slots__ = ['x'] |
| 1629 | |
| 1630 | def set_slot(n): |
| 1631 | c = C() |
| 1632 | for i in range(n): |
| 1633 | c.x = i |
| 1634 | |
| 1635 | set_slot(_testinternalcapi.SPECIALIZATION_THRESHOLD) |
| 1636 | |
| 1637 | self.assert_specialized(set_slot, "STORE_ATTR_SLOT") |
| 1638 | self.assert_no_opcode(set_slot, "STORE_ATTR") |
| 1639 | |
| 1640 | # Adding a property for 'x' should unspecialize it. |
| 1641 | C.x = property(lambda self: None, lambda self, x: None) |
| 1642 | set_slot(_testinternalcapi.SPECIALIZATION_COOLDOWN) |
| 1643 | self.assert_no_opcode(set_slot, "STORE_ATTR_SLOT") |
| 1644 | |
| 1645 | @cpython_only |
| 1646 | @requires_specialization |
nothing calls this directly
no test coverage detected