Skip to content

Commit fc1c644

Browse files
[3.13] gh-146615: Fix format specifiers in extension modules (GH-146617) (GH-146652) (GH-146658)
(cherry picked from commit 1c396e1) (cherry picked from commit 58c7259) Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
1 parent 52bc5c2 commit fc1c644

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

Modules/_asynciomodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,7 +1943,7 @@ enter_task(asyncio_state *state, PyObject *loop, PyObject *task)
19431943
PyExc_RuntimeError,
19441944
"Cannot enter into task %R while another " \
19451945
"task %R is being executed.",
1946-
task, item, NULL);
1946+
task, item);
19471947
Py_DECREF(item);
19481948
return -1;
19491949
}
@@ -2062,7 +2062,7 @@ _asyncio_Task___init___impl(TaskObj *self, PyObject *coro, PyObject *loop,
20622062
self->task_log_destroy_pending = 0;
20632063
PyErr_Format(PyExc_TypeError,
20642064
"a coroutine was expected, got %R",
2065-
coro, NULL);
2065+
coro);
20662066
return -1;
20672067
}
20682068

Modules/_ssl.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3537,15 +3537,11 @@ _ssl__SSLContext_verify_flags_set_impl(PySSLContext *self, PyObject *value)
35373537
static int
35383538
set_min_max_proto_version(PySSLContext *self, PyObject *arg, int what)
35393539
{
3540-
long v;
3540+
int v;
35413541
int result;
35423542

3543-
if (!PyArg_Parse(arg, "l", &v))
3543+
if (!PyArg_Parse(arg, "i", &v))
35443544
return -1;
3545-
if (v > INT_MAX) {
3546-
PyErr_SetString(PyExc_OverflowError, "Option is too long");
3547-
return -1;
3548-
}
35493545

35503546
switch(self->protocol) {
35513547
case PY_SSL_VERSION_TLS_CLIENT: /* fall through */
@@ -3580,7 +3576,7 @@ set_min_max_proto_version(PySSLContext *self, PyObject *arg, int what)
35803576
break;
35813577
default:
35823578
PyErr_Format(PyExc_ValueError,
3583-
"Unsupported TLS/SSL version 0x%x", v);
3579+
"Unsupported TLS/SSL version 0x%x", (unsigned)v);
35843580
return -1;
35853581
}
35863582

@@ -3614,7 +3610,7 @@ set_min_max_proto_version(PySSLContext *self, PyObject *arg, int what)
36143610
}
36153611
if (result == 0) {
36163612
PyErr_Format(PyExc_ValueError,
3617-
"Unsupported protocol version 0x%x", v);
3613+
"Unsupported protocol version 0x%x", (unsigned)v);
36183614
return -1;
36193615
}
36203616
return 0;

Modules/_zoneinfo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ load_data(zoneinfo_state *state, PyZoneInfo_ZoneInfo *self, PyObject *file_obj)
989989
}
990990

991991
if (!PyTuple_CheckExact(data_tuple)) {
992-
PyErr_Format(PyExc_TypeError, "Invalid data result type: %r",
992+
PyErr_Format(PyExc_TypeError, "Invalid data result type: %R",
993993
data_tuple);
994994
goto error;
995995
}

0 commit comments

Comments
 (0)