Commit 2b979bfa authored by Victor Stinner's avatar Victor Stinner

Use PyUnicode_CompareWithASCIIString() instead of Py_UNICODE_strcmp() to avoid

the deprecate Py_UNICODE type
parent 0fc35196
...@@ -1803,13 +1803,12 @@ test_string_from_format(PyObject *self, PyObject *args) ...@@ -1803,13 +1803,12 @@ test_string_from_format(PyObject *self, PyObject *args)
{ {
PyObject *result; PyObject *result;
char *msg; char *msg;
static const Py_UNICODE one[] = {'1', 0};
#define CHECK_1_FORMAT(FORMAT, TYPE) \ #define CHECK_1_FORMAT(FORMAT, TYPE) \
result = PyUnicode_FromFormat(FORMAT, (TYPE)1); \ result = PyUnicode_FromFormat(FORMAT, (TYPE)1); \
if (result == NULL) \ if (result == NULL) \
return NULL; \ return NULL; \
if (Py_UNICODE_strcmp(PyUnicode_AS_UNICODE(result), one)) { \ if (PyUnicode_CompareWithASCIIString(result, "1")) { \
msg = FORMAT " failed at 1"; \ msg = FORMAT " failed at 1"; \
goto Fail; \ goto Fail; \
} \ } \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment