File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,9 @@ Unreleased
13
13
message to the description if ``e.show_exception `` is set to
14
14
``True ``. This is a more secure default than the original 0.15.0
15
15
behavior and makes it easier to control without losing information.
16
- (:pr: `1592 `)
16
+ :pr: `1592 `
17
+ - Work around an issue in some external debuggers that caused the
18
+ reloader to fail. :issue: `1607 `
17
19
18
20
19
21
Version 0.15.4
Original file line number Diff line number Diff line change @@ -68,13 +68,15 @@ def _get_args_for_reloading():
68
68
a program other than python)
69
69
"""
70
70
rv = [sys .executable ]
71
- py_script = os . path . abspath ( sys .argv [0 ])
71
+ py_script = sys .argv [0 ]
72
72
args = sys .argv [1 :]
73
73
# Need to look at main module to determine how it was executed.
74
74
__main__ = sys .modules ["__main__" ]
75
75
76
76
if __main__ .__package__ is None :
77
77
# Executed a file, like "python app.py".
78
+ py_script = os .path .abspath (py_script )
79
+
78
80
if os .name == "nt" :
79
81
# Windows entry points have ".exe" extension and should be
80
82
# called directly.
@@ -101,11 +103,16 @@ def _get_args_for_reloading():
101
103
# TODO remove this once Flask no longer misbehaves
102
104
args = sys .argv
103
105
else :
104
- py_module = __main__ .__package__
105
- name = os .path .splitext (os .path .basename (py_script ))[0 ]
106
+ if os .path .isfile (py_script ):
107
+ # Rewritten by Python from "-m script" to "/path/to/script.py".
108
+ py_module = __main__ .__package__
109
+ name = os .path .splitext (os .path .basename (py_script ))[0 ]
106
110
107
- if name != "__main__" :
108
- py_module += "." + name
111
+ if name != "__main__" :
112
+ py_module += "." + name
113
+ else :
114
+ # Incorrectly rewritten by pydevd debugger from "-m script" to "script".
115
+ py_module = py_script
109
116
110
117
rv .extend (("-m" , py_module .lstrip ("." )))
111
118
You can’t perform that action at this time.
0 commit comments