https://github.com/python/cpython/commit/badf54fcd505e25464d1806b6437723a4faeb503
commit: badf54fcd505e25464d1806b6437723a4faeb503
branch: main
author: Cody Maloney <[email protected]>
committer: cmaloney <[email protected]>
date: 2026-11-22T11:50:58-08:00
summary:

gh-87613: Reject deprecated parameters in AC VC (#160857)

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 <[email protected]>

files:
M Lib/test/test_clinic.py
M Tools/clinic/libclinic/dsl_parser.py

diff --git a/Lib/test/test_clinic.py b/Lib/test/test_clinic.py
index 775628251f79f4b..ac0ed2c77d4e4a4 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,

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to