(self)
| 1645 | @cpython_only |
| 1646 | @requires_specialization |
| 1647 | def test_store_attr_instance_value(self): |
| 1648 | class C: |
| 1649 | pass |
| 1650 | |
| 1651 | @reset_code |
| 1652 | def set_value(n): |
| 1653 | c = C() |
| 1654 | for i in range(n): |
| 1655 | c.x = i |
| 1656 | |
| 1657 | set_value(_testinternalcapi.SPECIALIZATION_THRESHOLD) |
| 1658 | |
| 1659 | self.assert_specialized(set_value, "STORE_ATTR_INSTANCE_VALUE") |
| 1660 | self.assert_no_opcode(set_value, "STORE_ATTR") |
| 1661 | |
| 1662 | # Adding a property for 'x' should unspecialize it. |
| 1663 | C.x = property(lambda self: None, lambda self, x: None) |
| 1664 | set_value(_testinternalcapi.SPECIALIZATION_COOLDOWN) |
| 1665 | self.assert_no_opcode(set_value, "STORE_ATTR_INSTANCE_VALUE") |
| 1666 | |
| 1667 | @cpython_only |
| 1668 | @requires_specialization |
nothing calls this directly
no test coverage detected