Content-Length: 315323 | pFad | http://github.com/python/cpython/commit/6c502ba809ff662a5eebf8c6778dec6bd28918fb

41 gh-114101: Correct PyErr_Format arguments in _testcapi module (#114102) · python/cpython@6c502ba · GitHub
Skip to content

Commit 6c502ba

Browse files
authored
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
1 parent 8fd287b commit 6c502ba

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Modules/_testcapi/getargs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ parse_tuple_and_keywords(PyObject *self, PyObject *args)
5656
keywords[i] = PyBytes_AS_STRING(o);
5757
}
5858
else {
59-
PyErr_Format(PyExc_ValueError,
59+
PyErr_SetString(PyExc_ValueError,
6060
"parse_tuple_and_keywords: "
61-
"keywords must be str or bytes", i);
61+
"keywords must be str or bytes");
6262
goto exit;
6363
}
6464
}

Modules/_testcapimodule.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ test_sizeof_c_types(PyObject *self, PyObject *Py_UNUSED(ignored))
112112
return (PyObject*)NULL; \
113113
}
114114
#define IS_SIGNED(TYPE) (((TYPE)-1) < (TYPE)0)
115-
#define CHECK_SIGNNESS(TYPE, SIGNED) \
116-
if (IS_SIGNED(TYPE) != SIGNED) { \
117-
PyErr_Format(get_testerror(self), \
118-
"%s signness is, instead of %i", \
119-
#TYPE, IS_SIGNED(TYPE), SIGNED); \
120-
return (PyObject*)NULL; \
115+
#define CHECK_SIGNNESS(TYPE, SIGNED) \
116+
if (IS_SIGNED(TYPE) != SIGNED) { \
117+
PyErr_Format(get_testerror(self), \
118+
"%s signness is %i, instead of %i", \
119+
#TYPE, IS_SIGNED(TYPE), SIGNED); \
120+
return (PyObject*)NULL; \
121121
}
122122

123123
/* integer types */

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/python/cpython/commit/6c502ba809ff662a5eebf8c6778dec6bd28918fb

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy