File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -408,10 +408,19 @@ int load_tkinter_funcs(void)
408
408
// Load tkinter global funcs from tkinter compiled module.
409
409
// Return 0 for success, non-zero for failure.
410
410
int ret = -1 ;
411
- void *tkinter_lib;
411
+ void *main_program, * tkinter_lib;
412
412
char *tkinter_libname;
413
413
PyObject *pModule = NULL , *pSubmodule = NULL , *pString = NULL ;
414
414
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
415
424
pModule = PyImport_ImportModule (TKINTER_PKG);
416
425
if (pModule == NULL ) {
417
426
goto exit ;
You can’t perform that action at this time.
0 commit comments