diff options
author | Guido van Rossum <guido@python.org> | 2023-08-25 16:40:27 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-25 16:40:27 (GMT) |
commit | 53470184091f6fe1c7a1cf4de8fd90dc2ced7654 (patch) | |
tree | 562912625c7802bbe8453689003976da17de024b /Lib/test/test_opcache.py | |
parent | 66b4d9c9f0b8a935b5d464abd2f6ee0253832fd9 (diff) | |
download | cpython-53470184091f6fe1c7a1cf4de8fd90dc2ced7654.zip cpython-53470184091f6fe1c7a1cf4de8fd90dc2ced7654.tar.gz cpython-53470184091f6fe1c7a1cf4de8fd90dc2ced7654.tar.bz2 |
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>
Diffstat (limited to 'Lib/test/test_opcache.py')
-rw-r--r-- | Lib/test/test_opcache.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_opcache.py b/Lib/test/test_opcache.py index 1baa10c..692e03f 100644 --- a/Lib/test/test_opcache.py +++ b/Lib/test/test_opcache.py @@ -8,6 +8,19 @@ from test.support import threading_helper 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): def test_descriptor_not_double_executed_on_spec_fail(self): calls = [] @@ -502,6 +515,7 @@ class TestRacesDoNotCrash(unittest.TestCase): opnames = {instruction.opname for instruction in instructions} self.assertIn(opname, opnames) + @disabling_optimizer def assert_races_do_not_crash( self, opname, get_items, read, write, *, check_items=False ): |