Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Remove 'yield' from some request handlers #1267

Merged
merged 1 commit into from
Mar 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions src/ptvsd/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,12 @@ def pydevd_notify(self, cmd_id, args, is_json=False):
else:
seq, s = self.make_packet(cmd_id, args)
with self.lock:
os.write(self.pipe_w, s.encode('utf8'))
as_bytes = s
if not isinstance(as_bytes, bytes):
as_bytes = as_bytes.encode('utf-8')
if is_json:
os.write(self.pipe_w, ('Content-Length:%s\r\n\r\n' % (len(as_bytes),)).encode('ascii'))
os.write(self.pipe_w, as_bytes)

def pydevd_request(self, loop, cmd_id, args, is_json=False):
'''
Expand Down Expand Up @@ -1696,8 +1701,8 @@ def on_pause(self, request, args):
pydevd_request['arguments'] = {'threadId': '*'}

# Always suspend all threads.
yield self.pydevd_request(pydevd_comm.CMD_THREAD_SUSPEND,
pydevd_request, is_json=True)
self.pydevd_request(pydevd_comm.CMD_THREAD_SUSPEND,
pydevd_request, is_json=True)
self.send_response(request)

@async_handler
Expand All @@ -1711,8 +1716,8 @@ def on_continue(self, request, args):
pydevd_request['arguments'] = {'threadId': '*'}

# Always continue all threads.
yield self.pydevd_request(pydevd_comm.CMD_THREAD_RUN,
pydevd_request, is_json=True)
self.pydevd_request(pydevd_comm.CMD_THREAD_RUN,
pydevd_request, is_json=True)
self.send_response(request, allThreadsContinued=True)

@async_handler
Expand All @@ -1725,7 +1730,7 @@ def on_next(self, request, args):
pydevd_request['arguments']['threadId'] = pyd_tid
cmd_id = pydevd_comm.CMD_STEP_OVER

yield self.pydevd_request(cmd_id, pydevd_request, is_json=True)
self.pydevd_request(cmd_id, pydevd_request, is_json=True)
self.send_response(request)

@async_handler
Expand All @@ -1738,7 +1743,7 @@ def on_stepIn(self, request, args):
pydevd_request['arguments']['threadId'] = pyd_tid
cmd_id = pydevd_comm.CMD_STEP_INTO

yield self.pydevd_request(cmd_id, pydevd_request, is_json=True)
self.pydevd_request(cmd_id, pydevd_request, is_json=True)
self.send_response(request)

@async_handler
Expand All @@ -1751,7 +1756,7 @@ def on_stepOut(self, request, args):
pydevd_request['arguments']['threadId'] = pyd_tid
cmd_id = pydevd_comm.CMD_STEP_RETURN

yield self.pydevd_request(cmd_id, pydevd_request, is_json=True)
self.pydevd_request(cmd_id, pydevd_request, is_json=True)
self.send_response(request)

@async_handler
Expand Down