diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py
index b5285dafde22c3b9ce667b564bc6832ab31b5626..6adb69ac6eef512de6af5bd925788a8014010abe 100644
--- a/Cython/Compiler/Nodes.py
+++ b/Cython/Compiler/Nodes.py
@@ -4451,7 +4451,7 @@ static int __Pyx_CheckKeywords(
                 #if PY_MAJOR_VERSION >= 3
                 PyObject* utf8_key = PyUnicode_AsUTF8String(key);
                 if (!utf8_key) return -1;
-                if (strcmp(*name, PyString_AS_STRING(utf8_key)) == 0) {
+                if (strcmp(*name, PyBytes_AS_STRING(utf8_key)) == 0) {
                      Py_DECREF(utf8_key);
                      break;
                 }