https://github.com/python/cpython/commit/58c7259133bed4c0bff6a0d3939ddccf95e543f7
commit: 58c7259133bed4c0bff6a0d3939ddccf95e543f7
branch: 3.14
author: Serhiy Storchaka <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2026-03-31T10:07:09Z
summary:

[3.14] gh-146615: Fix format specifiers in extension modules (GH-146617) 
(GH-146652)

(cherry picked from commit 1c396e18218daa723b425af0781c5e762d7717c2)

Co-authored-by: sunmy2019 <[email protected]>

files:
M Modules/_asynciomodule.c
M Modules/_ssl.c
M Modules/_zoneinfo.c

diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index 6ec50b15200d6f..50ee180e495235 100644
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -2255,7 +2255,7 @@ enter_task(PyObject *loop, PyObject *task)
             PyExc_RuntimeError,
             "Cannot enter into task %R while another " \
             "task %R is being executed.",
-            task, ts->asyncio_running_task, NULL);
+            task, ts->asyncio_running_task);
         return -1;
     }
 
@@ -2278,7 +2278,7 @@ leave_task(PyObject *loop, PyObject *task)
             PyExc_RuntimeError,
             "Invalid attempt to leave task %R while " \
             "task %R is entered.",
-            task, ts->asyncio_running_task ? ts->asyncio_running_task : 
Py_None, NULL);
+            task, ts->asyncio_running_task ? ts->asyncio_running_task : 
Py_None);
         return -1;
     }
     Py_CLEAR(ts->asyncio_running_task);
@@ -2343,7 +2343,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;
     }
 
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index e5cfb6fb912805..1235eff72f7c12 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -577,7 +577,7 @@ fill_and_set_sslerror(_sslmodulestate *state,
     }
     else {
         if (PyUnicodeWriter_Format(
-                writer, "unknown error (0x%x)", errcode) < 0) {
+                writer, "unknown error (0x%lx)", errcode) < 0) {
             goto fail;
         }
     }
@@ -3597,15 +3597,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: _Py_FALLTHROUGH;
@@ -3640,7 +3636,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;
     }
 
@@ -3674,7 +3670,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;
diff --git a/Modules/_zoneinfo.c b/Modules/_zoneinfo.c
index 49e85473fdd881..dc219dc7ad94d1 100644
--- a/Modules/_zoneinfo.c
+++ b/Modules/_zoneinfo.c
@@ -988,7 +988,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;
     }

_______________________________________________
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