(self)
| 526 | @requires_jit_disabled |
| 527 | @requires_specialization |
| 528 | def test_assign_init_code(self): |
| 529 | class MyClass: |
| 530 | def __init__(self): |
| 531 | pass |
| 532 | |
| 533 | def instantiate(): |
| 534 | return MyClass() |
| 535 | |
| 536 | # Trigger specialization |
| 537 | for _ in range(_testinternalcapi.SPECIALIZATION_THRESHOLD): |
| 538 | instantiate() |
| 539 | self.assert_specialized(instantiate, "CALL_ALLOC_AND_ENTER_INIT") |
| 540 | |
| 541 | def count_args(self, *args): |
| 542 | self.num_args = len(args) |
| 543 | |
| 544 | # Set MyClass.__init__.__code__ to a code object that uses different |
| 545 | # args |
| 546 | MyClass.__init__.__code__ = count_args.__code__ |
| 547 | instantiate() |
| 548 | |
| 549 | @requires_jit_disabled |
| 550 | @requires_specialization |
nothing calls this directly
no test coverage detected