eric6/DebugClients/Python/ModuleLoader.py

branch
multi_processing
changeset 7424
9bb7d8b0f966
parent 7409
1413bfe73d41
child 7563
b0d6b63f2843
equal deleted inserted replaced
7422:9a008ab4811b 7424:9bb7d8b0f966
9 9
10 import sys 10 import sys
11 import importlib 11 import importlib
12 12
13 from QProcessExtension import patchQProcess 13 from QProcessExtension import patchQProcess
14 from SubprocessExtension import patchSubprocess
14 15
15 16
16 class ModuleLoader(object): 17 class ModuleLoader(object):
17 """ 18 """
18 Class implementing an import hook patching modules to support debugging. 19 Class implementing an import hook patching modules to support debugging.
34 del sys.modules[moduleName] 35 del sys.modules[moduleName]
35 36
36 self.__modulesToPatch = ( 37 self.__modulesToPatch = (
37 'thread', '_thread', 'threading', 38 'thread', '_thread', 'threading',
38 'greenlet', 39 'greenlet',
40 'subprocess',
39 'PyQt4.QtCore', 'PyQt5.QtCore', 41 'PyQt4.QtCore', 'PyQt5.QtCore',
40 'PySide.QtCore', 'PySide2.QtCore', 42 'PySide.QtCore', 'PySide2.QtCore',
41 ) 43 )
42 44
43 sys.meta_path.insert(0, self) 45 sys.meta_path.insert(0, self)
76 not hasattr(module, 'eric6_patched') 78 not hasattr(module, 'eric6_patched')
77 ): 79 ):
78 if self.__dbgClient.patchGreenlet(module): 80 if self.__dbgClient.patchGreenlet(module):
79 module.eric6_patched = True 81 module.eric6_patched = True
80 82
83 ## Add hook for subprocess.Popen()
84 elif (
85 fullname == 'subprocess' and
86 not hasattr(module, 'eric6_patched')
87 ):
88 module.eric6_patched = True
89 patchSubprocess(module, self.__dbgClient)
90
81 ## Add hook for *.QThread and *.QProcess 91 ## Add hook for *.QThread and *.QProcess
82 elif ( 92 elif (
83 fullname in ('PyQt4.QtCore', 'PyQt5.QtCore', 93 fullname in ('PyQt4.QtCore', 'PyQt5.QtCore',
84 'PySide.QtCore', 'PySide2.QtCore') and 94 'PySide.QtCore', 'PySide2.QtCore') and
85 not hasattr(module, 'eric6_patched') 95 not hasattr(module, 'eric6_patched')

eric ide

mercurial