Skip to content

Commit def8ea0

Browse files
[3.13] gh-146615: Fix format specifiers in test cextensions (GH-146618) (GH-146653)
(cherry picked from commit b705553) Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
1 parent c09ccd9 commit def8ea0

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

Modules/_testcapi/watchers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ add_code_watcher(PyObject *self, PyObject *which_watcher)
363363
watcher_id = PyCode_AddWatcher(error_code_event_handler);
364364
}
365365
else {
366-
PyErr_Format(PyExc_ValueError, "invalid watcher %d", which_l);
366+
PyErr_Format(PyExc_ValueError, "invalid watcher %ld", which_l);
367367
return NULL;
368368
}
369369
if (watcher_id < 0) {

Modules/_testcapimodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ test_sizeof_c_types(PyObject *self, PyObject *Py_UNUSED(ignored))
106106
#define CHECK_SIZEOF(TYPE, EXPECTED) \
107107
if (EXPECTED != sizeof(TYPE)) { \
108108
PyErr_Format(get_testerror(self), \
109-
"sizeof(%s) = %u instead of %u", \
109+
"sizeof(%s) = %zu instead of %u", \
110110
#TYPE, sizeof(TYPE), EXPECTED); \
111111
return (PyObject*)NULL; \
112112
}

Modules/_testinternalcapi.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,14 @@ test_bswap(PyObject *self, PyObject *Py_UNUSED(args))
125125
uint16_t u16 = _Py_bswap16(UINT16_C(0x3412));
126126
if (u16 != UINT16_C(0x1234)) {
127127
PyErr_Format(PyExc_AssertionError,
128-
"_Py_bswap16(0x3412) returns %u", u16);
128+
"_Py_bswap16(0x3412) returns %d", u16);
129129
return NULL;
130130
}
131131

132132
uint32_t u32 = _Py_bswap32(UINT32_C(0x78563412));
133133
if (u32 != UINT32_C(0x12345678)) {
134134
PyErr_Format(PyExc_AssertionError,
135-
"_Py_bswap32(0x78563412) returns %lu", u32);
135+
"_Py_bswap32(0x78563412) returns %u", u32);
136136
return NULL;
137137
}
138138

@@ -446,7 +446,7 @@ test_edit_cost(PyObject *self, PyObject *Py_UNUSED(args))
446446

447447
static int
448448
check_bytes_find(const char *haystack0, const char *needle0,
449-
int offset, Py_ssize_t expected)
449+
Py_ssize_t offset, Py_ssize_t expected)
450450
{
451451
Py_ssize_t len_haystack = strlen(haystack0);
452452
Py_ssize_t len_needle = strlen(needle0);
@@ -864,7 +864,7 @@ get_interp_settings(PyObject *self, PyObject *args)
864864
}
865865
else {
866866
PyErr_Format(PyExc_NotImplementedError,
867-
"%zd", interpid);
867+
"%d", interpid);
868868
return NULL;
869869
}
870870
assert(interp != NULL);

0 commit comments

Comments
 (0)