summaryrefslogtreecommitdiff
path: root/Lib/pdb.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/pdb.py')
-rwxr-xr-xLib/pdb.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/Lib/pdb.py b/Lib/pdb.py
index 47972655f9..97618b0ff1 100755
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -52,7 +52,8 @@ If a file ".pdbrc" exists in your home directory or in the current
directory, it is read in and executed as if it had been typed at the
debugger prompt. This is particularly useful for aliases. If both
files exist, the one in the home directory is read first and aliases
-defined there can be overridden by the local file.
+defined there can be overridden by the local file. This behavior can be
+disabled by passing the "readrc=False" argument to the Pdb constructor.
Aside from aliases, the debugger is not directly programmable; but it
is implemented as a class from which you can derive your own debugger
@@ -137,7 +138,7 @@ class Pdb(bdb.Bdb, cmd.Cmd):
_previous_sigint_handler = None
def __init__(self, completekey='tab', stdin=None, stdout=None, skip=None,
- nosigint=False):
+ nosigint=False, readrc=True):
bdb.Bdb.__init__(self, skip=skip)
cmd.Cmd.__init__(self, completekey, stdin, stdout)
if stdout:
@@ -160,18 +161,19 @@ class Pdb(bdb.Bdb, cmd.Cmd):
# Read $HOME/.pdbrc and ./.pdbrc
self.rcLines = []
- if 'HOME' in os.environ:
- envHome = os.environ['HOME']
+ if readrc:
+ if 'HOME' in os.environ:
+ envHome = os.environ['HOME']
+ try:
+ with open(os.path.join(envHome, ".pdbrc")) as rcFile:
+ self.rcLines.extend(rcFile)
+ except OSError:
+ pass
try:
- with open(os.path.join(envHome, ".pdbrc")) as rcFile:
+ with open(".pdbrc") as rcFile:
self.rcLines.extend(rcFile)
except OSError:
pass
- try:
- with open(".pdbrc") as rcFile:
- self.rcLines.extend(rcFile)
- except OSError:
- pass
self.commands = {} # associates a command list to breakpoint numbers
self.commands_doprompt = {} # for each bp num, tells if the prompt