| 353 | |
| 354 | |
| 355 | class Pdb(bdb.Bdb, cmd.Cmd): |
| 356 | _previous_sigint_handler = None |
| 357 | |
| 358 | # Limit the maximum depth of chained exceptions, we should be handling cycles, |
| 359 | # but in case there are recursions, we stop at 999. |
| 360 | MAX_CHAINED_EXCEPTION_DEPTH = 999 |
| 361 | |
| 362 | _file_mtime_table = {} |
| 363 | |
| 364 | _last_pdb_instance = None |
| 365 | |
| 366 | def __init__(self, completekey='tab', stdin=None, stdout=None, skip=None, |
| 367 | nosigint=False, readrc=True, mode=None, backend=None, colorize=False): |
| 368 | bdb.Bdb.__init__(self, skip=skip, backend=backend if backend else get_default_backend()) |
| 369 | cmd.Cmd.__init__(self, completekey, stdin, stdout) |
| 370 | sys.audit("pdb.Pdb") |
| 371 | if stdin is not None and stdin is not sys.stdin: |
| 372 | self.use_rawinput = False |
| 373 | self.prompt = '(Pdb) ' |
| 374 | self.aliases = {} |
| 375 | self.displaying = {} |
| 376 | self.mainpyfile = '' |
| 377 | self._wait_for_mainpyfile = False |
| 378 | self.tb_lineno = {} |
| 379 | self.mode = mode |
| 380 | self.colorize = colorize and _colorize.can_colorize(file=stdout or sys.stdout) |
| 381 | # Try to load readline if it exists |
| 382 | try: |
| 383 | import readline |
| 384 | # remove some common file name delimiters |
| 385 | readline.set_completer_delims(' \t\n`@#%^&*()=+[{]}\\|;:\'",<>?') |
| 386 | except ImportError: |
| 387 | pass |
| 388 | |
| 389 | self.allow_kbdint = False |
| 390 | self.nosigint = nosigint |
| 391 | # Consider these characters as part of the command so when the users type |
| 392 | # c.a or c['a'], it won't be recognized as a c(ontinue) command |
| 393 | self.identchars = cmd.Cmd.identchars + '=.[](),"\'+-*/%@&|<>~^' |
| 394 | |
| 395 | # Read ~/.pdbrc and ./.pdbrc |
| 396 | self.rcLines = [] |
| 397 | if readrc: |
| 398 | home_rcfile = os.path.expanduser("~/.pdbrc") |
| 399 | local_rcfile = os.path.abspath(".pdbrc") |
| 400 | |
| 401 | try: |
| 402 | with open(home_rcfile, encoding='utf-8') as rcfile: |
| 403 | self.rcLines.extend(rcfile) |
| 404 | except OSError: |
| 405 | pass |
| 406 | |
| 407 | if local_rcfile != home_rcfile: |
| 408 | try: |
| 409 | with open(local_rcfile, encoding='utf-8') as rcfile: |
| 410 | self.rcLines.extend(rcfile) |
| 411 | except OSError: |
| 412 | pass |
no outgoing calls
no test coverage detected