]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-136288: Fix error message in `_testcapi/vectorcall.c` (GH-136258) (GH-136295)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 4 Jul 2025 16:17:10 +0000 (18:17 +0200)
committerGitHub <noreply@github.com>
Fri, 4 Jul 2025 16:17:10 +0000 (16:17 +0000)
gh-136288: Fix error message in `_testcapi/vectorcall.c` (GH-136258)

Use the %N format specifier instead of %s and `PyType_GetName`.
(cherry picked from commit d1d5dce14f90d777608e4403d09079421ff55944)

Co-authored-by: William S Fulton <wsf@fultondesigns.co.uk>
Modules/_testcapi/vectorcall.c

index 03aaacb328e0b6d15d4a6b764443c026b3160d49..f89dcb6c4cf03c1c2885cf6b39584c1040209b9c 100644 (file)
@@ -179,14 +179,14 @@ _testcapi_VectorCallClass_set_vectorcall_impl(PyObject *self,
     if (!PyObject_TypeCheck(self, type)) {
         return PyErr_Format(
             PyExc_TypeError,
-            "expected %s instance",
-            PyType_GetName(type));
+            "expected %N instance",
+            type);
     }
     if (!type->tp_vectorcall_offset) {
         return PyErr_Format(
             PyExc_TypeError,
-            "type %s has no vectorcall offset",
-            PyType_GetName(type));
+            "type %N has no vectorcall offset",
+            type);
     }
     *(vectorcallfunc*)((char*)self + type->tp_vectorcall_offset) = (
         VectorCallClass_vectorcall);