File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -324,11 +324,16 @@ void load_tkinter_funcs(void)
324324
325325exit:
326326 // We don't need to keep a reference open as the main program & tkinter
327- // have been imported. Use a non-short-circuiting "or" to try closing both
328- // handles before handling errors .
329- if ((main_program && dlclose (main_program))
330- | (tkinter_lib && dlclose (tkinter_lib)) ) {
327+ // have been imported. Try to close each library separately (otherwise the
328+ // second dlclose could clear a dlerror from the first dlclose) .
329+ bool raised_dlerror = false ;
330+ if (main_program && dlclose (main_program) && !raised_dlerror ) {
331331 PyErr_SetString (PyExc_RuntimeError, dlerror ());
332+ raised_dlerror = true ;
333+ }
334+ if (tkinter_lib && dlclose (tkinter_lib) && !raised_dlerror) {
335+ PyErr_SetString (PyExc_RuntimeError, dlerror ());
336+ raised_dlerror = true ;
332337 }
333338 Py_XDECREF (module );
334339 Py_XDECREF (py_path);
You can’t perform that action at this time.
0 commit comments