File tree 1 file changed +9
-4
lines changed
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)
324
324
325
325
exit :
326
326
// 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 ) {
331
331
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 ;
332
337
}
333
338
Py_XDECREF (module);
334
339
Py_XDECREF (py_path);
You can’t perform that action at this time.
0 commit comments