diff options
author | Dong-hee Na <donghee.na@python.org> | 2023-08-21 21:22:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-21 21:22:18 (GMT) |
commit | e6db23f66d8741db0ffc526d8fd75373a5543e3e (patch) | |
tree | b1bf30896f0e2555503593bbdcd0d90cf1f5f973 /Lib | |
parent | 4b32d4f49cf1e9b49b072391256dbf5eddba4d93 (diff) | |
download | cpython-e6db23f66d8741db0ffc526d8fd75373a5543e3e.zip cpython-e6db23f66d8741db0ffc526d8fd75373a5543e3e.tar.gz cpython-e6db23f66d8741db0ffc526d8fd75373a5543e3e.tar.bz2 |
gh-107265: Fix code_hash for ENTER_EXECUTOR case (#108188)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_capi/test_misc.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_capi/test_misc.py b/Lib/test/test_capi/test_misc.py index ea05043..1cd4c56 100644 --- a/Lib/test/test_capi/test_misc.py +++ b/Lib/test/test_capi/test_misc.py @@ -2341,7 +2341,7 @@ class TestOptimizerAPI(unittest.TestCase): long_loop() self.assertEqual(opt.get_count(), 10) - def test_code_richcompare(self): + def test_code_restore_for_ENTER_EXECUTOR(self): def testfunc(x): i = 0 while i < x: @@ -2350,7 +2350,9 @@ class TestOptimizerAPI(unittest.TestCase): opt = _testinternalcapi.get_counter_optimizer() with temporary_optimizer(opt): testfunc(1000) - self.assertEqual(testfunc.__code__, testfunc.__code__.replace()) + code, replace_code = testfunc.__code__, testfunc.__code__.replace() + self.assertEqual(code, replace_code) + self.assertEqual(hash(code), hash(replace_code)) def get_first_executor(func): |