Skip to content

Commit

Permalink
BUG: fix C90 warning -> error in new tkagg code
Browse files Browse the repository at this point in the history
Same code in Pillow generating a compile error on OpenSUSE:

python-pillow/Pillow#2017

Apply same fix, by defining variables before use:

python-pillow/Pillow#2033
  • Loading branch information
matthew-brett committed Jul 18, 2016
1 parent e3fd1b1 commit 1d75cae
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/_tkagg.cpp
Expand Up @@ -351,7 +351,8 @@ int load_tkinter_funcs(void)
// From module __file__ attribute to char *string for dlopen.
char *fname2char(PyObject *fname)
{
PyObject *bytes = PyUnicode_EncodeFSDefault(fname);
PyObject* bytes;
bytes = PyUnicode_EncodeFSDefault(fname);
if (bytes == NULL) {
return NULL;
}
Expand All @@ -372,9 +373,10 @@ void *_dfunc(void *lib_handle, const char *func_name)
// Set Python exception if we can't find `func_name` in `lib_handle`.
// Returns function pointer or NULL if not present.

void* func;
// Reset errors.
dlerror();
void *func = dlsym(lib_handle, func_name);
func = dlsym(lib_handle, func_name);
if (func == NULL) {
const char *error = dlerror();
PyErr_SetString(PyExc_RuntimeError, error);
Expand Down

0 comments on commit 1d75cae

Please sign in to comment.