Skip to content

Commit 726b25b

Browse files
authored
Merge pull request #1613 from pallets/revert-nixos-reloader-check
don't detect executable file for reloader
2 parents a8d26bf + 1f532b8 commit 726b25b

2 files changed

Lines changed: 7 additions & 10 deletions

File tree

CHANGES.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ Unreleased
1919
reloader to fail. :issue:`1607`
2020
- Work around an issue where the reloader couldn't introspect a
2121
setuptools script installed as an egg. :issue:`1600`
22+
- The reloader will use ``sys.executable`` even if the script is
23+
marked executable, reverting a behavior intended for NixOS
24+
introduced in 0.15. The reloader should no longer cause
25+
``OSError: [Errno 8] Exec format error``. :issue:`1482`,
26+
:issue:`1580`
2227
- ``SharedDataMiddleware`` safely handles paths with Windows drive
2328
names. :issue:`1589`
2429

src/werkzeug/_reloader.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,8 @@ def _find_observable_paths(extra_files=None):
6161

6262

6363
def _get_args_for_reloading():
64-
"""Returns the executable. This contains a workaround for windows
65-
if the executable is incorrectly reported to not have the .exe
66-
extension which can cause bugs on reloading. This also contains
67-
a workaround for linux where the file is executable (possibly with
68-
a program other than python)
64+
"""Determine how the script was executed, and return the args needed
65+
to execute it again in a new process.
6966
"""
7067
rv = [sys.executable]
7168
py_script = sys.argv[0]
@@ -91,11 +88,6 @@ def _get_args_for_reloading():
9188
):
9289
rv.pop(0)
9390

94-
elif os.path.isfile(py_script) and os.access(py_script, os.X_OK):
95-
# The file is marked as executable. Nix adds a wrapper that
96-
# shouldn't be called with the Python executable.
97-
rv.pop(0)
98-
9991
rv.append(py_script)
10092
else:
10193
# Executed a module, like "python -m werkzeug.serving".

0 commit comments

Comments
 (0)