fixes for keyword arg checking
authorStefan Behnel <scoder@users.berlios.de>
Wed, 14 May 2008 23:10:13 +0000 (01:10 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Wed, 14 May 2008 23:10:13 +0000 (01:10 +0200)
Cython/Compiler/Nodes.py

index d169157b8d775aaf9d51e8d6880758d19e023a6e..878d985581c420e00d6d36116f6a33d0805c3e54 100644 (file)
@@ -4000,7 +4000,11 @@ static int __Pyx_CheckKeywordStrings(
     PyObject* key = 0;
     Py_ssize_t pos = 0;
     while (PyDict_Next(kwdict, &pos, &key, 0)) {
+        #if PY_MAJOR_VERSION < 3
         if (unlikely(!PyString_Check(key))) {
+        #else
+        if (unlikely(!PyUnicode_Check(key))) {
+        #endif
             PyErr_Format(PyExc_TypeError,
                          "%s() keywords must be strings", function_name);
             return 0;
@@ -4009,7 +4013,11 @@ static int __Pyx_CheckKeywordStrings(
     if (unlikely(!kw_allowed) && unlikely(key)) {
         PyErr_Format(PyExc_TypeError,
                      "'%s' is an invalid keyword argument for this function",
+        #if PY_MAJOR_VERSION < 3
                      PyString_AsString(key));
+        #else
+                     PyUnicode_AsString(key));
+        #endif
         return 0;
     }
     return 1;