mirror of
https://github.com/python/cpython.git
synced 2025-11-03 11:23:31 +00:00
gh-108311: Fix test_store_attr_with_hint by disabling optimizer in decorator (#108312)
See https://github.com/python/cpython/issues/108311#issuecomment-1693569380 --------- Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
This commit is contained in:
parent
66b4d9c9f0
commit
5347018409
1 changed files with 14 additions and 0 deletions
|
|
@ -8,6 +8,19 @@ from test.support import threading_helper
|
||||||
import _testinternalcapi
|
import _testinternalcapi
|
||||||
|
|
||||||
|
|
||||||
|
def disabling_optimizer(func):
|
||||||
|
def wrapper(*args, **kwargs):
|
||||||
|
import _testinternalcapi
|
||||||
|
old_opt = _testinternalcapi.get_optimizer()
|
||||||
|
_testinternalcapi.set_optimizer(None)
|
||||||
|
try:
|
||||||
|
return func(*args, **kwargs)
|
||||||
|
finally:
|
||||||
|
_testinternalcapi.set_optimizer(old_opt)
|
||||||
|
|
||||||
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
class TestLoadSuperAttrCache(unittest.TestCase):
|
class TestLoadSuperAttrCache(unittest.TestCase):
|
||||||
def test_descriptor_not_double_executed_on_spec_fail(self):
|
def test_descriptor_not_double_executed_on_spec_fail(self):
|
||||||
calls = []
|
calls = []
|
||||||
|
|
@ -502,6 +515,7 @@ class TestRacesDoNotCrash(unittest.TestCase):
|
||||||
opnames = {instruction.opname for instruction in instructions}
|
opnames = {instruction.opname for instruction in instructions}
|
||||||
self.assertIn(opname, opnames)
|
self.assertIn(opname, opnames)
|
||||||
|
|
||||||
|
@disabling_optimizer
|
||||||
def assert_races_do_not_crash(
|
def assert_races_do_not_crash(
|
||||||
self, opname, get_items, read, write, *, check_items=False
|
self, opname, get_items, read, write, *, check_items=False
|
||||||
):
|
):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue