use Py_CHARMASK
diff --git a/Python/compile.c b/Python/compile.c
index 45bed39..cb25da2 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -608,12 +608,12 @@
 			*p++ = c;
 			break;
 		case 'x':
-			if (isxdigit(*s)) {
+			if (isxdigit(Py_CHARMASK(*s))) {
 				sscanf(s, "%x", &c);
 				*p++ = c;
 				do {
 					s++;
-				} while (isxdigit(*s));
+				} while (isxdigit(Py_CHARMASK(*s)));
 				break;
 			}
 		/* FALLTHROUGH */