Commit ea03270d authored by Stefan Behnel's avatar Stefan Behnel

free sys module reference earlier in encoding setup code

--HG--
extra : transplant_source : %CA%BB%21%89%8CQ%A0F%3EN%E5%7Cs%01%5D%060A%C8%AF
parent bbb740d8
...@@ -126,23 +126,23 @@ bad: ...@@ -126,23 +126,23 @@ bad:
static char* __PYX_DEFAULT_STRING_ENCODING; static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) { static int __Pyx_init_sys_getdefaultencoding_params(void) {
PyObject* sys = NULL; PyObject* sys;
PyObject* default_encoding = NULL; PyObject* default_encoding = NULL;
char* default_encoding_c; char* default_encoding_c;
sys = PyImport_ImportModule("sys"); sys = PyImport_ImportModule("sys");
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);
Py_DECREF(sys);
if (!default_encoding) goto bad; if (!default_encoding) goto bad;
default_encoding_c = PyBytes_AsString(default_encoding); default_encoding_c = PyBytes_AsString(default_encoding);
if (!default_encoding_c) goto bad; 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);
Py_DECREF(sys);
Py_DECREF(default_encoding); Py_DECREF(default_encoding);
return 0; return 0;
bad: bad:
Py_XDECREF(sys);
Py_XDECREF(default_encoding); Py_XDECREF(default_encoding);
return -1; return -1;
} }
......
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