]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-101261: add test for function with > 255 args (#101262)
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>
Mon, 23 Jan 2023 20:10:10 +0000 (20:10 +0000)
committerGitHub <noreply@github.com>
Mon, 23 Jan 2023 20:10:10 +0000 (20:10 +0000)
Lib/test/test_call.py

index c17528be97b484c3e305239cde515c70417e1801..aab7b1580eaf35932ba85e2468322592aeaa4519 100644 (file)
@@ -934,6 +934,16 @@ class TestRecursion(unittest.TestCase):
         finally:
             sys.setrecursionlimit(depth)
 
+class TestFunctionWithManyArgs(unittest.TestCase):
+    def test_function_with_many_args(self):
+        for N in (10, 500, 1000):
+            with self.subTest(N=N):
+                args = ",".join([f"a{i}" for i in range(N)])
+                src = f"def f({args}) : return a{N//2}"
+                l = {}
+                exec(src, {}, l)
+                self.assertEqual(l['f'](*range(N)), N//2)
+
 
 if __name__ == "__main__":
     unittest.main()