mirror of
https://github.com/python/cpython.git
synced 2025-11-02 06:31:29 +00:00
gh-91625: Don't ignore extended args of adaptive opcodes (GH-91626)
This commit is contained in:
parent
7659681556
commit
cec5d858f5
5 changed files with 66 additions and 18 deletions
|
|
@ -133,6 +133,18 @@ def test_eval_gives_lambda_custom_globals(self):
|
|||
|
||||
self.assertEqual(foo(), 7)
|
||||
|
||||
def test_load_global_specialization_failure_keeps_oparg(self):
|
||||
# https://github.com/python/cpython/issues/91625
|
||||
class MyGlobals(dict):
|
||||
def __missing__(self, key):
|
||||
return int(key.removeprefix("_number_"))
|
||||
|
||||
code = "lambda: " + "+".join(f"_number_{i}" for i in range(1000))
|
||||
sum_1000 = eval(code, MyGlobals())
|
||||
expected = sum(range(1000))
|
||||
# Warm up the the function for quickening (PEP 659)
|
||||
for _ in range(30):
|
||||
self.assertEqual(sum_1000(), expected)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue