8000 Merge pull request #7433 from matthew-brett/master · matplotlib/matplotlib@10f1522 · GitHub
[go: up one dir, main page]

Skip to content

Commit 10f1522

Browse files
authored
Merge pull request #7433 from matthew-brett/master
FIX: search for tkinter first in builtins
2 parents 3e89069 + b4cc9cc commit 10f1522

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/_tkagg.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,10 +410,19 @@ int load_tkinter_funcs(void)
410410
// Load tkinter global funcs from tkinter compiled module.
411411
// Return 0 for success, non-zero for failure.
412412
int ret = -1;
413-
void *tkinter_lib;
413+
void *main_program, *tkinter_lib;
414414
char *tkinter_libname;
415415
PyObject *pModule = NULL, *pSubmodule = NULL, *pString = NULL;
416416

417+
// Try loading from the main program namespace first
418+
main_program = dlopen(NULL, RTLD_LAZY);
419+
if (_func_loader(main_program) == 0) {
420+
return 0;
421+
}
422+
// Clear exception triggered when we didn't find symbols above.
423+
PyErr_Clear();
424+
425+
// Now try finding the tkinter compiled module
417426
pModule = PyImport_ImportModule(TKINTER_PKG);
418427
if (pModule == NULL) {
419428
goto exit;

0 commit comments

Comments
 (0)
0