Commit 9f70157c authored by Stefan Behnel's avatar Stefan Behnel

disable unicode default encoding in pypy: PyBytes_AsStringAndSize() does not...

disable unicode default encoding in pypy: PyBytes_AsStringAndSize() does not handle Unicode default encoding in pypy and _PyUnicode_AsDefaultEncodedString() does not return a cached borrowed reference but a new owned one
parent e9b1cbed
......@@ -180,7 +180,7 @@ static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
}
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
__Pyx_sys_getdefaultencoding_not_ascii &&
......@@ -188,7 +188,7 @@ static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_
PyUnicode_Check(o)) {
#if PY_VERSION_HEX < 0x03030000
char* defenc_c;
// borrowed, cached reference
// borrowed reference, cached internally in 'o' by CPython
PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
if (!defenc) return NULL;
defenc_c = PyBytes_AS_STRING(defenc);
......
......@@ -36,3 +36,4 @@ run.datetime_pxd
run.datetime_cimport
run.datetime_members
run.extern_builtins_T258
run.unicode_ascii_auto_encoding
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