DebugClients/Python/PyProfile.py

branch
jsonrpc
changeset 5132
a094eee9f862
parent 4631
5c1a96925da4
equal deleted inserted replaced
5131:889ed5ff7a68 5132:a094eee9f862
115 """ 115 """
116 # get module name from __file__ 116 # get module name from __file__
117 if not isinstance(frame, profile.Profile.fake_frame) and \ 117 if not isinstance(frame, profile.Profile.fake_frame) and \
118 '__file__' in frame.f_globals: 118 '__file__' in frame.f_globals:
119 root, ext = os.path.splitext(frame.f_globals['__file__']) 119 root, ext = os.path.splitext(frame.f_globals['__file__'])
120 if ext == '.pyc' or ext == '.py': 120 if ext in ['.pyc', '.py', '.py2', '.pyo']:
121 fixedName = root + '.py' 121 fixedName = root + '.py'
122 if os.path.exists(fixedName):
123 return fixedName
124
125 fixedName = root + '.py2'
122 if os.path.exists(fixedName): 126 if os.path.exists(fixedName):
123 return fixedName 127 return fixedName
124 128
125 return frame.f_code.co_filename 129 return frame.f_code.co_filename
126 130

eric ide

mercurial