]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-146615: Fix format specifiers in extension modules (GH-146617) (GH-146652...
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 31 Mar 2026 10:59:06 +0000 (13:59 +0300)
committerGitHub <noreply@github.com>
Tue, 31 Mar 2026 10:59:06 +0000 (10:59 +0000)
(cherry picked from commit 1c396e18218daa723b425af0781c5e762d7717c2)
(cherry picked from commit 58c7259133bed4c0bff6a0d3939ddccf95e543f7)

Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
Modules/_asynciomodule.c
Modules/_ssl.c
Modules/_zoneinfo.c

index 7e2fe28423399fb3061696dd5553dbff24f0c350..0ed899f5a7c142fa34d441a73d44c6e7afc13c1b 100644 (file)
@@ -1943,7 +1943,7 @@ enter_task(asyncio_state *state, PyObject *loop, PyObject *task)
             PyExc_RuntimeError,
             "Cannot enter into task %R while another " \
             "task %R is being executed.",
-            task, item, NULL);
+            task, item);
         Py_DECREF(item);
         return -1;
     }
@@ -2062,7 +2062,7 @@ _asyncio_Task___init___impl(TaskObj *self, PyObject *coro, PyObject *loop,
         self->task_log_destroy_pending = 0;
         PyErr_Format(PyExc_TypeError,
                      "a coroutine was expected, got %R",
-                     coro, NULL);
+                     coro);
         return -1;
     }
 
index b25ca379da4c2553d02c5c85023940b2a034093d..2d94fd985781ffd80696a63d249dc14ba37cfd62 100644 (file)
@@ -3537,15 +3537,11 @@ _ssl__SSLContext_verify_flags_set_impl(PySSLContext *self, PyObject *value)
 static int
 set_min_max_proto_version(PySSLContext *self, PyObject *arg, int what)
 {
-    long v;
+    int v;
     int result;
 
-    if (!PyArg_Parse(arg, "l", &v))
+    if (!PyArg_Parse(arg, "i", &v))
         return -1;
-    if (v > INT_MAX) {
-        PyErr_SetString(PyExc_OverflowError, "Option is too long");
-        return -1;
-    }
 
     switch(self->protocol) {
     case PY_SSL_VERSION_TLS_CLIENT:  /* fall through */
@@ -3580,7 +3576,7 @@ set_min_max_proto_version(PySSLContext *self, PyObject *arg, int what)
             break;
         default:
             PyErr_Format(PyExc_ValueError,
-                     "Unsupported TLS/SSL version 0x%x", v);
+                     "Unsupported TLS/SSL version 0x%x", (unsigned)v);
             return -1;
     }
 
@@ -3614,7 +3610,7 @@ set_min_max_proto_version(PySSLContext *self, PyObject *arg, int what)
     }
     if (result == 0) {
         PyErr_Format(PyExc_ValueError,
-                     "Unsupported protocol version 0x%x", v);
+                     "Unsupported protocol version 0x%x", (unsigned)v);
         return -1;
     }
     return 0;
index 2a4186bb12564dbe1e691ca36673614fb854445c..25cc4042ce92a39867c14db45154a2502a60d52c 100644 (file)
@@ -989,7 +989,7 @@ load_data(zoneinfo_state *state, PyZoneInfo_ZoneInfo *self, PyObject *file_obj)
     }
 
     if (!PyTuple_CheckExact(data_tuple)) {
-        PyErr_Format(PyExc_TypeError, "Invalid data result type: %r",
+        PyErr_Format(PyExc_TypeError, "Invalid data result type: %R",
                      data_tuple);
         goto error;
     }