Issue #28701: Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualToASCIIString.
The latter function is more readable, faster and doesn't raise exceptions.
diff --git a/Modules/_io/winconsoleio.c b/Modules/_io/winconsoleio.c
index 4666a38..7b00a9e 100644
--- a/Modules/_io/winconsoleio.c
+++ b/Modules/_io/winconsoleio.c
@@ -93,11 +93,11 @@
}
char m = '\0';
- if (PyUnicode_CompareWithASCIIString(decoded_upper, "CONIN$") == 0) {
+ if (_PyUnicode_EqualToASCIIString(decoded_upper, "CONIN$")) {
m = 'r';
- } else if (PyUnicode_CompareWithASCIIString(decoded_upper, "CONOUT$") == 0) {
+ } else if (_PyUnicode_EqualToASCIIString(decoded_upper, "CONOUT$")) {
m = 'w';
- } else if (PyUnicode_CompareWithASCIIString(decoded_upper, "CON") == 0) {
+ } else if (_PyUnicode_EqualToASCIIString(decoded_upper, "CON")) {
m = 'x';
}