Skip to content

Commit fe10edb

Browse files
Stop using DONT_DEBUG.
1 parent 012dbba commit fe10edb

File tree

7 files changed

+34
-10
lines changed

7 files changed

+34
-10
lines changed

pythonFiles/ptvsd_launcher.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,11 @@
1919
sys.path.insert(0, ptvs_lib_path)
2020
try:
2121
import ptvsd
22-
import ptvsd.debugger as vspd
2322
from ptvsd.__main__ import main
2423
ptvsd_loaded = True
2524
except ImportError:
2625
ptvsd_loaded = False
2726
raise
28-
vspd.DONT_DEBUG.append(os.path.normcase(__file__))
2927
except:
3028
traceback.print_exc()
3129
print('''

pythonFiles/testlauncher.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ def exclude_current_file_from_debugger():
2020
# Load the debugger package
2121
try:
2222
import ptvsd
23-
import ptvsd.debugger as vspd
24-
vspd.DONT_DEBUG.append(os.path.normcase(__file__))
2523
except:
2624
traceback.print_exc()
2725
print('''

pythonFiles/visualstudio_py_testlauncher.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def main():
222222
(opts, _) = parser.parse_args()
223223

224224
if opts.debug:
225-
from ptvsd.visualstudio_py_debugger import DONT_DEBUG, DEBUG_ENTRYPOINTS, get_code
225+
from ptvsd.visualstudio_py_debugger import DEBUG_ENTRYPOINTS, get_code
226226

227227
sys.path[0] = os.getcwd()
228228
if opts.result_port:
@@ -238,7 +238,7 @@ def main():
238238
sys.stderr = _TestOutput(sys.stderr, is_stdout = False)
239239

240240
if opts.debug:
241-
DONT_DEBUG.append(os.path.normcase(__file__))
241+
# TODO: Stop using this internal API? (See #3201.)
242242
DEBUG_ENTRYPOINTS.add(get_code(main))
243243

244244
pass

src/test/pythonFiles/folding/attach_server.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,12 @@
8383
ATCH = to_bytes('ATCH')
8484
REPL = to_bytes('REPL')
8585

86+
PY_ROOT = os.path.normcase(__file__)
87+
while os.path.basename(PY_ROOT) != 'pythonFiles':
88+
PY_ROOT = os.path.dirname(PY_ROOT)
89+
8690
_attach_enabled = False
8791
_attached = threading.Event()
88-
vspd.DONT_DEBUG.append(os.path.normcase(__file__))
8992

9093

9194
class AttachAlreadyEnabledError(Exception):
@@ -238,6 +241,10 @@ def server_thread_func():
238241

239242
elif response == ATCH:
240243
debug_options = vspd.parse_debug_options(read_string(client))
244+
debug_options.setdefault('rules', []).append({
245+
'path': PY_ROOT,
246+
'include': False,
247+
})
241248
if redirect_output:
242249
debug_options.add('RedirectOutput')
243250

src/test/pythonFiles/folding/noComments.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,12 @@
3535
ATCH = to_bytes('ATCH')
3636
REPL = to_bytes('REPL')
3737

38+
PY_ROOT = os.path.normcase(__file__)
39+
while os.path.basename(PY_ROOT) != 'pythonFiles':
40+
PY_ROOT = os.path.dirname(PY_ROOT)
41+
3842
_attach_enabled = False
3943
_attached = threading.Event()
40-
vspd.DONT_DEBUG.append(os.path.normcase(__file__))
4144

4245

4346
class AttachAlreadyEnabledError(Exception):
@@ -187,6 +190,10 @@ def server_thread_func():
187190

188191
elif response == ATCH:
189192
debug_options = vspd.parse_debug_options(read_string(client))
193+
debug_options.setdefault('rules', []).append({
194+
'path': PY_ROOT,
195+
'include': False,
196+
})
190197
if redirect_output:
191198
debug_options.add('RedirectOutput')
192199

src/test/pythonFiles/folding/noDocStrings.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,12 @@
8383
ATCH = to_bytes('ATCH')
8484
REPL = to_bytes('REPL')
8585

86+
PY_ROOT = os.path.normcase(__file__)
87+
while os.path.basename(PY_ROOT) != 'pythonFiles':
88+
PY_ROOT = os.path.dirname(PY_ROOT)
89+
8690
_attach_enabled = False
8791
_attached = threading.Event()
88-
vspd.DONT_DEBUG.append(os.path.normcase(__file__))
8992

9093

9194
class AttachAlreadyEnabledError(Exception):
@@ -187,6 +190,10 @@ def server_thread_func():
187190

188191
elif response == ATCH:
189192
debug_options = vspd.parse_debug_options(read_string(client))
193+
debug_options.setdefault('rules', []).append({
194+
'path': PY_ROOT,
195+
'include': False,
196+
})
190197
if redirect_output:
191198
debug_options.add('RedirectOutput')
192199

src/test/pythonFiles/folding/visualstudio_py_repl.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@
7171

7272
DEBUG = os.environ.get('DEBUG_REPL') is not None
7373

74+
PY_ROOT = os.path.normcase(__file__)
75+
while os.path.basename(PY_ROOT) != 'pythonFiles':
76+
PY_ROOT = os.path.dirname(PY_ROOT)
77+
7478
__all__ = ['ReplBackend', 'BasicReplBackend', 'BACKEND']
7579

7680
def _debug_write(out):
@@ -349,6 +353,10 @@ def _cmd_debug_attach(self):
349353
port = read_int(self.conn)
350354
id = read_string(self.conn)
351355
debug_options = visualstudio_py_debugger.parse_debug_options(read_string(self.conn))
356+
debug_options.setdefault('rules', []).append({
357+
'path': PY_ROOT,
358+
'include': False,
359+
})
352360
self.attach_process(port, id, debug_options)
353361

354362
_COMMANDS = {
@@ -380,7 +388,6 @@ def init_debugger(self):
380388
from os import path
381389
sys.path.append(path.dirname(__file__))
382390
import visualstudio_py_debugger
383-
visualstudio_py_debugger.DONT_DEBUG.append(path.normcase(__file__))
384391
new_thread = visualstudio_py_debugger.new_thread()
385392
sys.settrace(new_thread.trace_func)
386393
visualstudio_py_debugger.intercept_threads(True)

0 commit comments

Comments
 (0)