Skip to content

Commit

Permalink
Modifying debugger to return the same breakpoints in 'debugInfo' resp…
Browse files Browse the repository at this point in the history
…onse as 'setBreakpoints' (#1140)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
vaishnavi17 and pre-commit-ci[bot] authored Aug 4, 2023
1 parent c851746 commit 18e54f3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ipykernel/debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,15 @@ async def setBreakpoints(self, message):
"""Handle a set breakpoints message."""
source = message["arguments"]["source"]["path"]
self.breakpoint_list[source] = message["arguments"]["breakpoints"]
return await self._forward_message(message)
message_response = await self._forward_message(message)
# debugpy can set breakpoints on different lines than the ones requested,
# so we want to record the breakpoints that were actually added
if "success" in message_response and message_response["success"]:
self.breakpoint_list[source] = [
{"line": breakpoint["line"]}
for breakpoint in message_response["body"]["breakpoints"]
]
return message_response

async def source(self, message):
"""Handle a source message."""
Expand Down

0 comments on commit 18e54f3

Please sign in to comment.