MCPcopy Index your code
hub / github.com/ipython/ipython / __init__

Method __init__

IPython/core/debugger.py:240–335  ·  view source on GitHub ↗

Create a new IPython debugger. Parameters ---------- completekey : default None Passed to pdb.Pdb. stdin : default None Passed to pdb.Pdb. stdout : default None Passed to pdb.Pdb. context : int Number of

(
        self,
        completekey=None,
        stdin=None,
        stdout=None,
        context: int | None | str = 5,
        *,
        mode: str | None = None,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

238 }
239
240 def __init__(
241 self,
242 completekey=None,
243 stdin=None,
244 stdout=None,
245 context: int | None | str = 5,
246 *,
247 mode: str | None = None,
248 **kwargs,
249 ):
250 """Create a new IPython debugger.
251
252 Parameters
253 ----------
254 completekey : default None
255 Passed to pdb.Pdb.
256 stdin : default None
257 Passed to pdb.Pdb.
258 stdout : default None
259 Passed to pdb.Pdb.
260 context : int
261 Number of lines of source code context to show when
262 displaying stacktrace information.
263 mode : str, optional
264 How the debugger was invoked, one of ``'inline'`` (used by the
265 ``breakpoint()`` builtin), ``'cli'`` (used by the command line
266 invocation) or ``None`` (backwards compatible behaviour). This
267 argument was added to stdlib's ``pdb.Pdb`` in Python 3.14; it is
268 accepted on every supported Python version here but only forwarded
269 to the underlying ``pdb.Pdb`` when it is actually supported.
270 **kwargs
271 Passed to pdb.Pdb.
272
273 Notes
274 -----
275 The possibilities are python version dependent, see the python
276 docs for more info.
277 """
278 # ipdb issue, see https://github.com/ipython/ipython/issues/14811
279 if context is None:
280 context = 5
281 if isinstance(context, str):
282 context = int(context)
283 self.context = context
284
285 # The `mode` argument was added to `pdb.Pdb` in Python 3.14. We accept
286 # it on every supported Python version so that callers written against
287 # 3.14+ keep working, but only forward it to the underlying `pdb.Pdb`
288 # when it understands it.
289 if sys.version_info >= (3, 14):
290 kwargs["mode"] = mode
291 else:
292 self.mode = mode
293
294 # `kwargs` ensures full compatibility with stdlib's `pdb.Pdb`.
295 OldPdb.__init__(self, completekey, stdin, stdout, **kwargs)
296 # Python 3.15+ should define this, so no need to initialize
297 # this avoids some getattr(self, 'curframe')

Callers

nothing calls this directly

Calls 2

set_theme_nameMethod · 0.95
get_ipythonFunction · 0.90

Tested by

no test coverage detected