(self)
| 1667 | @cpython_only |
| 1668 | @requires_specialization |
| 1669 | def test_store_attr_with_hint(self): |
| 1670 | class C: |
| 1671 | pass |
| 1672 | |
| 1673 | c = C() |
| 1674 | for i in range(_testinternalcapi.SHARED_KEYS_MAX_SIZE - 1): |
| 1675 | setattr(c, f"_{i}", None) |
| 1676 | |
| 1677 | @reset_code |
| 1678 | def set_value(n): |
| 1679 | for i in range(n): |
| 1680 | c.x = i |
| 1681 | |
| 1682 | set_value(_testinternalcapi.SPECIALIZATION_THRESHOLD) |
| 1683 | |
| 1684 | self.assert_specialized(set_value, "STORE_ATTR_WITH_HINT") |
| 1685 | self.assert_no_opcode(set_value, "STORE_ATTR") |
| 1686 | |
| 1687 | # Adding a property for 'x' should unspecialize it. |
| 1688 | C.x = property(lambda self: None, lambda self, x: None) |
| 1689 | set_value(_testinternalcapi.SPECIALIZATION_COOLDOWN) |
| 1690 | self.assert_no_opcode(set_value, "STORE_ATTR_WITH_HINT") |
| 1691 | |
| 1692 | @cpython_only |
| 1693 | @requires_specialization |
nothing calls this directly
no test coverage detected