summaryrefslogtreecommitdiff
path: root/Lib/cProfile.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/cProfile.py')
-rwxr-xr-xLib/cProfile.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/cProfile.py b/Lib/cProfile.py
index 9fc9788302..f7000a8bfa 100755
--- a/Lib/cProfile.py
+++ b/Lib/cProfile.py
@@ -7,6 +7,7 @@
__all__ = ["run", "runctx", "Profile"]
import _lsprof
+import importlib.machinery
import profile as _pyprofile
# ____________________________________________________________
@@ -169,9 +170,12 @@ def main():
sys.path.insert(0, os.path.dirname(progname))
with open(progname, 'rb') as fp:
code = compile(fp.read(), progname, 'exec')
+ spec = importlib.machinery.ModuleSpec(name='__main__', loader=None,
+ origin=progname)
globs = {
- '__file__': progname,
- '__name__': '__main__',
+ '__spec__': spec,
+ '__file__': spec.origin,
+ '__name__': spec.name,
'__package__': None,
'__cached__': None,
}