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 b4cc9cc

Browse filesBrowse files
committed
FIX: search for tkinter first in builtins
Python compiled from Python.org source builds the tkinter module as a built-in module, not an external module, as is the case for the packaged builds of Debian etc: >>> Tkinter.tkinter <module '_tkinter' (built-in)> This breaks the MPL algorithm for searching for tkinter symbols, which loaded the external module .so file to get the symbols. Try searching in the main program namespace for the tkinter symbols, before looking for the extermal module .so file. Thanks to github user ettaka for reporting : see #7428
1 parent 3e89069 commit b4cc9cc
Copy full SHA for b4cc9cc

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
@@ -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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.