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 @@ -410,10 +410,19 @@ int load_tkinter_funcs(void)
410
410
// Load tkinter global funcs from tkinter compiled module.
411
411
// Return 0 for success, non-zero for failure.
412
412
int ret = -1 ;
413
- void *tkinter_lib;
413
+ void *main_program, * tkinter_lib;
414
414
char *tkinter_libname;
415
415
PyObject *pModule = NULL , *pSubmodule = NULL , *pString = NULL ;
416
416
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
417
426
pModule = PyImport_ImportModule (TKINTER_PKG);
418
427
if (pModule == NULL ) {
419
428
goto exit;
You can’t perform that action at this time.
0 commit comments