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 |