summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAN Long <aisk@users.noreply.github.com>2024-01-16 08:32:39 (GMT)
committerGitHub <noreply@github.com>2024-01-16 08:32:39 (GMT)
commit6c502ba809ff662a5eebf8c6778dec6bd28918fb (patch)
tree5fcdc14f8c46a3a2981378d6c6eff04fd849aceb
parent8fd287b18f20f0a310203f574adec196530627c7 (diff)
downloadcpython-6c502ba809ff662a5eebf8c6778dec6bd28918fb.zip
cpython-6c502ba809ff662a5eebf8c6778dec6bd28918fb.tar.gz
cpython-6c502ba809ff662a5eebf8c6778dec6bd28918fb.tar.bz2
gh-114101: Correct PyErr_Format arguments in _testcapi module (#114102)
- use PyErr_SetString() iso. PyErr_Format() in parse_tuple_and_keywords() - fix misspelled format specifier in CHECK_SIGNNESS() macro
-rw-r--r--Modules/_testcapi/getargs.c4
-rw-r--r--Modules/_testcapimodule.c12
2 files changed, 8 insertions, 8 deletions
diff --git a/Modules/_testcapi/getargs.c b/Modules/_testcapi/getargs.c
index 33e8af7..0d61d8c 100644
--- a/Modules/_testcapi/getargs.c
+++ b/Modules/_testcapi/getargs.c
@@ -56,9 +56,9 @@ parse_tuple_and_keywords(PyObject *self, PyObject *args)
keywords[i] = PyBytes_AS_STRING(o);
}
else {
- PyErr_Format(PyExc_ValueError,
+ PyErr_SetString(PyExc_ValueError,
"parse_tuple_and_keywords: "
- "keywords must be str or bytes", i);
+ "keywords must be str or bytes");
goto exit;
}
}
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index a0b21b7..6def680 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -112,12 +112,12 @@ test_sizeof_c_types(PyObject *self, PyObject *Py_UNUSED(ignored))
return (PyObject*)NULL; \
}
#define IS_SIGNED(TYPE) (((TYPE)-1) < (TYPE)0)
-#define CHECK_SIGNNESS(TYPE, SIGNED) \
- if (IS_SIGNED(TYPE) != SIGNED) { \
- PyErr_Format(get_testerror(self), \
- "%s signness is, instead of %i", \
- #TYPE, IS_SIGNED(TYPE), SIGNED); \
- return (PyObject*)NULL; \
+#define CHECK_SIGNNESS(TYPE, SIGNED) \
+ if (IS_SIGNED(TYPE) != SIGNED) { \
+ PyErr_Format(get_testerror(self), \
+ "%s signness is %i, instead of %i", \
+ #TYPE, IS_SIGNED(TYPE), SIGNED); \
+ return (PyObject*)NULL; \
}
/* integer types */