Skip to content

Commit 966d6d3

Browse files
authored
Fix PyUnicode functions for Python 3.13 (#17504)
Replace `_PyUnicode_EqualToASCIIString` with `PyUnicode_EqualToUTF8`. https://docs.python.org/dev/c-api/unicode.html#c.PyUnicode_EqualToUTF8 python/cpython#110289 Fixes ```cpp /home/runner/work/mypy/mypy/mypyc/lib-rt/getargs.c: In function ‘vgetargskeywords’: (diff) /home/runner/work/mypy/mypy/mypyc/lib-rt/pythonsupport.h:310:45: error: implicit declaration of function ‘_PyUnicode_EqualToASCIIString’; did you mean ‘CPyUnicode_EqualToASCIIString’? [-Werror=implicit-function-declaration] (diff) 310 | #define CPyUnicode_EqualToASCIIString(x, y) _PyUnicode_EqualToASCIIString(x, y) (diff) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (diff) /home/runner/work/mypy/mypy/mypyc/lib-rt/getargs.c:398:21: note: in expansion of macro ‘CPyUnicode_EqualToASCIIString’ (diff) 398 | if (CPyUnicode_EqualToASCIIString(key, kwlist[i])) { (diff) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (diff) ```
1 parent 7f67090 commit 966d6d3

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

mypyc/lib-rt/getargs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ vgetargskeywords(PyObject *args, PyObject *kwargs, const char *format,
395395
goto latefail;
396396
}
397397
for (i = pos; i < len; i++) {
398-
if (CPyUnicode_EqualToASCIIString(key, kwlist[i])) {
398+
if (PyUnicode_EqualToUTF8(key, kwlist[i])) {
399399
match = 1;
400400
break;
401401
}

mypyc/lib-rt/pythonsupport.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,6 @@ list_count(PyListObject *self, PyObject *value)
307307
return CPyTagged_ShortFromSsize_t(count);
308308
}
309309

310-
#define CPyUnicode_EqualToASCIIString(x, y) _PyUnicode_EqualToASCIIString(x, y)
311-
312310
// Adapted from genobject.c in Python 3.7.2
313311
// Copied because it wasn't in 3.5.2 and it is undocumented anyways.
314312
/*

0 commit comments

Comments
 (0)