Commit 24f56e14 authored by Robert Bradshaw's avatar Robert Bradshaw

MSVC fixes.

parent 0d651b18
...@@ -136,18 +136,21 @@ static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_ ...@@ -136,18 +136,21 @@ static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_
#endif #endif
PyUnicode_Check(o)) { PyUnicode_Check(o)) {
#if PY_VERSION_HEX < 0x03030000 #if PY_VERSION_HEX < 0x03030000
char* defenc_c;
// borrowed, cached reference // borrowed, cached reference
PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
if (!defenc) return NULL; if (!defenc) return NULL;
char* defenc_c = PyBytes_AS_STRING(defenc); defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
char* end = defenc_c + PyBytes_GET_SIZE(defenc); {
char* c; char* end = defenc_c + PyBytes_GET_SIZE(defenc);
for (c = defenc_c; c < end; c++) { char* c;
if ((unsigned char) (*c) >= 128) { for (c = defenc_c; c < end; c++) {
// raise the error if ((unsigned char) (*c) >= 128) {
PyUnicode_AsASCIIString(o); // raise the error
return NULL; PyUnicode_AsASCIIString(o);
return NULL;
}
} }
} }
#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/ #endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment