Commit bbb740d8 authored by Stefan Behnel's avatar Stefan Behnel

make encoding setup code safer by not expecting sys.getdefaultencoding() to...

make encoding setup code safer by not expecting sys.getdefaultencoding() to safely return a bytes object

--HG--
extra : transplant_source : cZx%3E%03l%AC%EDK%E3%C2%F2%2C%9BV%E5%EC%5D%B7%C8
parent 4ca95f80
...@@ -133,7 +133,8 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { ...@@ -133,7 +133,8 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) {
if (!sys) goto bad; if (!sys) goto bad;
default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
if (!default_encoding) goto bad; if (!default_encoding) goto bad;
default_encoding_c = PyBytes_AS_STRING(default_encoding); default_encoding_c = PyBytes_AsString(default_encoding);
if (!default_encoding_c) goto bad;
__PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
......
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