@@ -270,13 +270,14 @@ class Debugger:
270270 'richInspectVariables' , 'modules'
271271 ]
272272
273- def __init__ (self , log , debugpy_stream , event_callback , shell_socket , session ):
273+ def __init__ (self , log , debugpy_stream , event_callback , shell_socket , session , just_my_code = True ):
274274 self .log = log
275275 self .debugpy_client = DebugpyClient (log , debugpy_stream , self ._handle_event )
276276 self .shell_socket = shell_socket
277277 self .session = session
278278 self .is_started = False
279279 self .event_callback = event_callback
280+ self .just_my_code = just_my_code
280281 self .stopped_queue = Queue ()
281282
282283 self .started_debug_handlers = {}
@@ -515,11 +516,12 @@ async def attach(self, message):
515516 'port' : port
516517 }
517518 message ['arguments' ]['logToFile' ] = True
518- # Reverts that option for now since it leads to spurious break of the code
519- # in ipykernel source and resuming the execution leads to several errors
520- # in the kernel .
519+ # Experimental option to break in non-user code.
520+ # The ipykernel source is in the call stack, so the user
521+ # has to manipulate the step-over and step-into in a wize way .
521522 # Set debugOptions for breakpoints in python standard library source.
522- # message['arguments']['debugOptions'] = [ 'DebugStdLib' ]
523+ if not self .just_my_code :
524+ message ['arguments' ]['debugOptions' ] = [ 'DebugStdLib' ]
523525 return await self ._forward_message (message )
524526
525527 async def configurationDone (self , message ):
0 commit comments