36 for moduleName in ("thread", "_thread", "threading"): |
38 for moduleName in ("thread", "_thread", "threading"): |
37 if moduleName in sys.modules: |
39 if moduleName in sys.modules: |
38 del sys.modules[moduleName] |
40 del sys.modules[moduleName] |
39 |
41 |
40 self.__modulesToPatch = ( |
42 self.__modulesToPatch = ( |
41 'thread', '_thread', 'threading', |
43 'thread', '_thread', 'threading', |
42 'greenlet', |
44 'greenlet', |
43 'PyQt4.QtCore', 'PyQt5.QtCore', |
45 'PyQt4.QtCore', 'PyQt5.QtCore', |
44 'PySide.QtCore', 'PySide2.QtCore', |
46 'PySide.QtCore', 'PySide2.QtCore', |
45 ) |
47 ) |
46 |
48 |
47 sys.meta_path.insert(0, self) |
49 sys.meta_path.insert(0, self) |
48 |
50 |
49 def __loadModule(self, fullname): |
51 def __loadModule(self, fullname): |
50 """ |
52 """ |
51 Public method to load a module. |
53 Private method to load a module. |
52 |
54 |
53 @param fullname name of the module to be loaded |
55 @param fullname name of the module to be loaded |
54 @type str |
56 @type str |
55 @return reference to the loaded module |
57 @return reference to the loaded module |
56 @rtype module |
58 @rtype module |
80 not hasattr(module, 'eric6_patched') |
82 not hasattr(module, 'eric6_patched') |
81 ): |
83 ): |
82 if self.__dbgClient.patchGreenlet(module): |
84 if self.__dbgClient.patchGreenlet(module): |
83 module.eric6_patched = True |
85 module.eric6_patched = True |
84 |
86 |
85 ## Add hook for *.QThread |
87 ## Add hook for *.QThread and *.QProcess |
86 elif ( |
88 elif ( |
87 fullname in ('PyQt4.QtCore', 'PyQt5.QtCore', |
89 fullname in ('PyQt4.QtCore', 'PyQt5.QtCore', |
88 'PySide.QtCore', 'PySide2.QtCore') and |
90 'PySide.QtCore', 'PySide2.QtCore') and |
89 not hasattr(module, 'eric6_patched') |
91 not hasattr(module, 'eric6_patched') |
90 ): |
92 ): |
91 module.eric6_patched = True |
93 module.eric6_patched = True |
92 self.__dbgClient.patchQThread(module) |
94 self.__dbgClient.patchQThread(module) |
|
95 patchQProcess(module, self.__dbgClient.startOptions) |
93 |
96 |
94 self.__enableImportHooks = True |
97 self.__enableImportHooks = True |
95 return module |
98 return module |
96 |
99 |
97 if sys.version_info >= (3, 4): |
100 if sys.version_info >= (3, 4): |