summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_descr.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r--Lib/test/test_descr.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 5d36cb9..378ff52 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -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...