BUG: fix C90 compilation error for new Tk method

New Tk code that picks up libraries at run-time causes complaints and errors;
fix.

See: https://github.com/python-pillow/Pillow/issues/2017
This commit is contained in:
Matthew Brett 2016-07-17 17:58:53 +00:00
parent 37841dbaeb
commit f3565f3300

View File

@ -371,7 +371,8 @@ int load_tkinter_funcs(void)
#if PY_VERSION_HEX >= 0x03000000 #if PY_VERSION_HEX >= 0x03000000
char *fname2char(PyObject *fname) char *fname2char(PyObject *fname)
{ {
PyObject *bytes = PyUnicode_EncodeFSDefault(fname); PyObject* bytes;
bytes = PyUnicode_EncodeFSDefault(fname);
if (bytes == NULL) { if (bytes == NULL) {
return NULL; return NULL;
} }
@ -391,9 +392,10 @@ void *_dfunc(void *lib_handle, const char *func_name)
* Returns function pointer or NULL if not present. * Returns function pointer or NULL if not present.
*/ */
void* func;
/* Reset errors. */ /* Reset errors. */
dlerror(); dlerror();
void *func = dlsym(lib_handle, func_name); func = dlsym(lib_handle, func_name);
if (func == NULL) { if (func == NULL) {
const char *error = dlerror(); const char *error = dlerror();
PyErr_SetString(PyExc_RuntimeError, error); PyErr_SetString(PyExc_RuntimeError, error);