Index: Objects/unicodeobject.c =================================================================== --- Objects/unicodeobject.c (revision 86736) +++ Objects/unicodeobject.c (working copy) @@ -7782,11 +7782,14 @@ Return True if all characters in S are alphabetic\n\ and there is at least one character in S, False otherwise."); +#define IS_HIGH_SURROGATE(ch) (0xD800 <= ch && ch <= 0xDBFF) + static PyObject* unicode_isalpha(PyUnicodeObject *self) { register const Py_UNICODE *p = PyUnicode_AS_UNICODE(self); register const Py_UNICODE *e; + Py_UCS4 ch; /* Shortcut for single character strings */ if (PyUnicode_GET_SIZE(self) == 1 && @@ -7799,7 +7802,11 @@ e = p + PyUnicode_GET_SIZE(self); for (; p < e; p++) { - if (!Py_UNICODE_ISALPHA(*p)) + if IS_HIGH_SURROGATE(*p) + ch = ((*p - 0xD800) << 10 | (*(++p) - 0xDC00)) + 0x10000; + else + ch = (Py_UCS4)p; + if (!Py_UNICODE_ISALPHA(ch)) return PyBool_FromLong(0); } return PyBool_FromLong(1);