Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 033c3f2

Browse filesBrowse files
committed
Merge pull request #7433 from matthew-brett/master
FIX: search for tkinter first in builtins
1 parent a3d7af4 commit 033c3f2
Copy full SHA for 033c3f2

File tree

Expand file treeCollapse file tree

1 file changed

+10
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-1
lines changed

‎src/_tkagg.cpp

Copy file name to clipboardExpand all lines: src/_tkagg.cpp
+10-1Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,10 +408,19 @@ int load_tkinter_funcs(void)
408408
// Load tkinter global funcs from tkinter compiled module.
409409
// Return 0 for success, non-zero for failure.
410410
int ret = -1;
411-
void *tkinter_lib;
411+
void *main_program, *tkinter_lib;
412412
char *tkinter_libname;
413413
PyObject *pModule = NULL, *pSubmodule = NULL, *pString = NULL;
414414

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.