From: Sven Date: Fri, 16 Jun 2017 08:43:29 +0000 (+0200) Subject: Apply changes from review X-Git-Tag: v5.0.0~69^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2081%2Fhead;p=thirdparty%2Ftornado.git Apply changes from review --- diff --git a/tornado/autoreload.py b/tornado/autoreload.py index ad6cec366..da1b100d7 100644 --- a/tornado/autoreload.py +++ b/tornado/autoreload.py @@ -217,19 +217,20 @@ def _reload(): # $PYTHONPATH. spec = getattr(sys.modules['__main__'], '__spec__', None) if spec: - sys.argv = ['-m', spec.name] + sys.argv[1:] + argv = ['-m', spec.name] + sys.argv[1:] else: + argv = sys.argv path_prefix = '.' + os.pathsep if (sys.path[0] == '' and not os.environ.get("PYTHONPATH", "").startswith(path_prefix)): os.environ["PYTHONPATH"] = (path_prefix + os.environ.get("PYTHONPATH", "")) if not _has_execv: - subprocess.Popen([sys.executable] + sys.argv) + subprocess.Popen([sys.executable] + argv) sys.exit(0) else: try: - os.execv(sys.executable, [sys.executable] + sys.argv) + os.execv(sys.executable, [sys.executable] + argv) except OSError: # Mac OS X versions prior to 10.6 do not support execv in # a process that contains multiple threads. Instead of @@ -242,8 +243,7 @@ def _reload(): # Unfortunately the errno returned in this case does not # appear to be consistent, so we can't easily check for # this error specifically. - os.spawnv(os.P_NOWAIT, sys.executable, - [sys.executable] + sys.argv) + os.spawnv(os.P_NOWAIT, sys.executable, [sys.executable] + argv) # At this point the IOLoop has been closed and finally # blocks will experience errors if we allow the stack to # unwind, so just exit uncleanly. diff --git a/tornado/test/import_test.py b/tornado/test/import_test.py index e5eaec332..88d02e027 100644 --- a/tornado/test/import_test.py +++ b/tornado/test/import_test.py @@ -9,6 +9,7 @@ class ImportTest(unittest.TestCase): # all (unless they have external dependencies) here to at # least ensure that there are no syntax errors. import tornado.auth + import tornado.autoreload import tornado.concurrent import tornado.escape import tornado.gen