DebugClients/Python/coverage/execfile.py

branch
maintenance
changeset 6693
3629d88ae235
parent 6649
f1b3a73831c9
diff -r 2a11e1b2dcbe -r 3629d88ae235 DebugClients/Python/coverage/execfile.py
--- a/DebugClients/Python/coverage/execfile.py	Thu Jan 10 14:23:49 2019 +0100
+++ b/DebugClients/Python/coverage/execfile.py	Sat Feb 02 11:12:54 2019 +0100
@@ -111,7 +111,15 @@
 
     pathname = os.path.abspath(pathname)
     args[0] = pathname
-    run_python_file(pathname, args, package=packagename, modulename=modulename, path0="")
+    # Python 3.7.0b3 changed the behavior of the sys.path[0] entry for -m. It
+    # used to be an empty string (meaning the current directory). It changed
+    # to be the actual path to the current directory, so that os.chdir wouldn't
+    # affect the outcome.
+    if sys.version_info >= (3, 7, 0, 'beta', 3):
+        path0 = os.getcwd()
+    else:
+        path0 = ""
+    run_python_file(pathname, args, package=packagename, modulename=modulename, path0=path0)
 
 
 def run_python_file(filename, args, package=None, modulename=None, path0=None):

eric ide

mercurial