From c36be7c70f478fe7c0157c4e47f9f3f9daf711f8 Mon Sep 17 00:00:00 2001 From: Cody Maloney Date: Wed, 28 Oct 2026 15:47:01 -0700 Subject: [PATCH] gh-87613: Reject deprecated parameters in AC VC The generated vectorcall can skip the DeprecationWarning for `/ [from X.Y]` and `* [from X.Y]` parameters, so report the combination as unsupported, like optional groups. Nothing in the tree uses these. They were used in a previous sqlite3 module migration (gh-93057, gh-108278).The last ones were removed in 2023 (gh-133595) Co-Authored-By: Claude Opus 5.5 --- Lib/test/test_clinic.py | 12 ++++++++++++ Tools/clinic/libclinic/dsl_parser.py | 3 +++ 2 files changed, 15 insertions(+) diff --git a/Lib/test/test_clinic.py b/Lib/test/test_clinic.py index e57f4c4a9d556af..966bb359ff3f5fc 100644 --- a/Lib/test/test_clinic.py +++ b/Lib/test/test_clinic.py @@ -3570,6 +3570,18 @@ class Foo "FooObject *" "Foo_Type" """ self.expect_failure(block, err, lineno=7) + def test_vectorcall_with_deprecated_parameters(self): + err = "@vectorcall does not support deprecated parameters" + block = """ + module m + class Foo "FooObject *" "Foo_Type" + @vectorcall + Foo.__init__ + a: object = None + / [from 3.14] + """ + self.expect_failure(block, err, lineno=5) + def test_unused_param(self): block = self.parse(""" module foo diff --git a/Tools/clinic/libclinic/dsl_parser.py b/Tools/clinic/libclinic/dsl_parser.py index d4fcf4d6b350c6d..7ac6b3b3d253947 100644 --- a/Tools/clinic/libclinic/dsl_parser.py +++ b/Tools/clinic/libclinic/dsl_parser.py @@ -1643,6 +1643,9 @@ def check_vectorcall_parameters(self, lineno: int) -> None: if p.group: fail("@vectorcall does not support optional groups", line_number=lineno) + if p.deprecated_positional or p.deprecated_keyword: + fail("@vectorcall does not support deprecated parameters", + line_number=lineno) if p.is_vararg() or p.is_var_keyword(): continue if isinstance(p.converter, (self_converter,