Commits

Robert Kern committed 1f22ff9

Get the namespace at the correct times in order to pick up the mungings that we do. Remove pointless demo.

Comments (0)

Files changed (2)

             extension = 'prof'
         options.outfile = '%s.%s' % (os.path.basename(args[0]), extension)
 
-    ns = locals()
 
     sys.argv[:] = args
     if options.setup is not None:
         # Make sure the script's directory is on sys.path instead of just
         # kernprof.py's.
         sys.path.insert(0, os.path.dirname(setup_file))
+        ns = locals()
         execfile(setup_file, ns, ns)
 
-    script_file = find_script(sys.argv[0])
-    __file__ = script_file
-    __name__ = '__main__'
-    # Make sure the script's directory is on sys.path instead of just
-    # kernprof.py's.
-    sys.path.insert(0, os.path.dirname(script_file))
-
     if options.line_by_line:
         import line_profiler
         prof = line_profiler.LineProfiler()
         import __builtin__
         __builtin__.__dict__['profile'] = prof
 
+    script_file = find_script(sys.argv[0])
+    __file__ = script_file
+    __name__ = '__main__'
+    # Make sure the script's directory is on sys.path instead of just
+    # kernprof.py's.
+    sys.path.insert(0, os.path.dirname(script_file))
+
     try:
         try:
+            ns = locals()
             if options.builtin:
                 execfile(script_file, ns, ns)
             else:

mystone.py

-#!/usr/bin/env python
-
-import os
-import pystone
-
-#import lineprof
-
-print os.getpid()
-#lineprof.enable()
-
-pystone.pystones()