mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +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
|
|
@ -1961,6 +1961,20 @@ order (MRO) for bases """
|
|||
del a[0:10]
|
||||
self.assertEqual(a.delitem, (slice(0, 10)))
|
||||
|
||||
def test_load_attr_extended_arg(self):
|
||||
# https://github.com/python/cpython/issues/91625
|
||||
class Numbers:
|
||||
def __getattr__(self, attr):
|
||||
return int(attr.lstrip("_"))
|
||||
attrs = ", ".join(f"Z._{n:03d}" for n in range(280))
|
||||
code = f"def number_attrs(Z):\n return [ {attrs} ]"
|
||||
ns = {}
|
||||
exec(code, ns)
|
||||
number_attrs = ns["number_attrs"]
|
||||
# Warm up the the function for quickening (PEP 659)
|
||||
for _ in range(30):
|
||||
self.assertEqual(number_attrs(Numbers()), list(range(280)))
|
||||
|
||||
def test_methods(self):
|
||||
# Testing methods...
|
||||
class C(object):
|
||||
|
|
@ -4435,8 +4449,8 @@ order (MRO) for bases """
|
|||
raise RuntimeError(f"Premature access to sys.stdout.{attr}")
|
||||
|
||||
with redirect_stdout(StdoutGuard()):
|
||||
with self.assertRaises(RuntimeError):
|
||||
print("Oops!")
|
||||
with self.assertRaises(RuntimeError):
|
||||
print("Oops!")
|
||||
|
||||
def test_vicious_descriptor_nonsense(self):
|
||||
# Testing vicious_descriptor_nonsense...
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue