]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-146615: Fix format specifiers in test cextensions (GH-146618) (GH-146653)
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 31 Mar 2026 08:38:59 +0000 (11:38 +0300)
committerGitHub <noreply@github.com>
Tue, 31 Mar 2026 08:38:59 +0000 (08:38 +0000)
(cherry picked from commit b7055533abc2f7f93e04778fb70664096aa3d3b5)

Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
Modules/_testcapi/watchers.c
Modules/_testcapimodule.c
Modules/_testinternalcapi.c

index 1eb0db2c2e65761e6e54e6148274caa9694657d7..d7594b0442423ac4f4baf663ad2822016ccb5634 100644 (file)
@@ -363,7 +363,7 @@ add_code_watcher(PyObject *self, PyObject *which_watcher)
         watcher_id = PyCode_AddWatcher(error_code_event_handler);
     }
     else {
-        PyErr_Format(PyExc_ValueError, "invalid watcher %d", which_l);
+        PyErr_Format(PyExc_ValueError, "invalid watcher %ld", which_l);
         return NULL;
     }
     if (watcher_id < 0) {
index 77905a60225895a4a272fe180f3c6f6ea24a4b75..51baf1e8ef667d0c1e4377c2cb3fa324c142c51a 100644 (file)
@@ -106,7 +106,7 @@ test_sizeof_c_types(PyObject *self, PyObject *Py_UNUSED(ignored))
 #define CHECK_SIZEOF(TYPE, EXPECTED)         \
     if (EXPECTED != sizeof(TYPE))  {         \
         PyErr_Format(get_testerror(self),    \
-            "sizeof(%s) = %u instead of %u", \
+            "sizeof(%s) = %zu instead of %u", \
             #TYPE, sizeof(TYPE), EXPECTED);  \
         return (PyObject*)NULL;              \
     }
index 6b5e73e924a2c849b85d3090df6853aac3957447..f9984da3671c8e34da404068003fe181e3af45b0 100644 (file)
@@ -125,14 +125,14 @@ test_bswap(PyObject *self, PyObject *Py_UNUSED(args))
     uint16_t u16 = _Py_bswap16(UINT16_C(0x3412));
     if (u16 != UINT16_C(0x1234)) {
         PyErr_Format(PyExc_AssertionError,
-                     "_Py_bswap16(0x3412) returns %u", u16);
+                     "_Py_bswap16(0x3412) returns %d", u16);
         return NULL;
     }
 
     uint32_t u32 = _Py_bswap32(UINT32_C(0x78563412));
     if (u32 != UINT32_C(0x12345678)) {
         PyErr_Format(PyExc_AssertionError,
-                     "_Py_bswap32(0x78563412) returns %lu", u32);
+                     "_Py_bswap32(0x78563412) returns %u", u32);
         return NULL;
     }
 
@@ -446,7 +446,7 @@ test_edit_cost(PyObject *self, PyObject *Py_UNUSED(args))
 
 static int
 check_bytes_find(const char *haystack0, const char *needle0,
-                 int offset, Py_ssize_t expected)
+                 Py_ssize_t offset, Py_ssize_t expected)
 {
     Py_ssize_t len_haystack = strlen(haystack0);
     Py_ssize_t len_needle = strlen(needle0);
@@ -864,7 +864,7 @@ get_interp_settings(PyObject *self, PyObject *args)
     }
     else {
         PyErr_Format(PyExc_NotImplementedError,
-                     "%zd", interpid);
+                     "%d", interpid);
         return NULL;
     }
     assert(interp != NULL);