gh-90370: Argument Clinic: avoid temporary tuple creation for varargs (#126064)

Avoid temporary tuple creation when all arguments either positional-only
or vararg.

Objects/setobject.c and Modules/gcmodule.c adapted. This fixes slight
performance regression for set methods, introduced by gh-115112.
This commit is contained in:
Sergey B Kirpichev 2024-10-31 13:37:03 +03:00 committed by GitHub
parent d07dcce693
commit 8c22eba877
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 209 additions and 222 deletions

View file

@ -3381,8 +3381,8 @@ class ClinicFunctionalTest(unittest.TestCase):
def test_varpos(self):
# fn(*args)
fn = ac_tester.varpos
self.assertEqual(fn(), ())
self.assertEqual(fn(1, 2), (1, 2))
self.assertEqual(fn(), ((),))
self.assertEqual(fn(1, 2), ((1, 2),))
def test_posonly_varpos(self):
# fn(a, b, /, *args)