/* size of a code word (must be unsigned short or larger, and
large enough to hold a UCS4 character) */
+#ifdef Py_USING_UNICODE
#define SRE_CODE Py_UCS4
+#else
+#define SRE_CODE unsigned long
+#endif
typedef struct {
PyObject_VAR_HEAD
n = pbuf.len;
}
else {
- const char *encoding, *errors;
PyObject *text;
if (!PyArg_ParseTuple(args, "O", &text))
return NULL;
if (PyString_Check(text)) {
s = PyString_AS_STRING(text);
n = PyString_GET_SIZE(text);
+#ifdef Py_USING_UNICODE
} else if (PyUnicode_Check(text)) {
+ const char *encoding, *errors;
if (f->f_encoding != Py_None)
encoding = PyString_AS_STRING(f->f_encoding);
else
return NULL;
s = PyString_AS_STRING(encoded);
n = PyString_GET_SIZE(encoded);
+#endif
} else {
if (PyObject_AsCharBuffer(text, &s, &n))
return NULL;