diff --git a/Lib/cmd.py b/Lib/cmd.py index 51495fb3216..ee124005e1c 100644 --- a/Lib/cmd.py +++ b/Lib/cmd.py @@ -111,7 +111,7 @@ class Cmd: import readline self.old_completer = readline.get_completer() readline.set_completer(self.complete) - if readline.backend == "editline": + if getattr(readline, 'backend', None) == "editline": if self.completekey == 'tab': # libedit uses "^I" instead of "tab" command_string = "bind ^I rl_complete" diff --git a/Lib/pdb.py b/Lib/pdb.py index eee0273fdc4..42a6580e258 100644 --- a/Lib/pdb.py +++ b/Lib/pdb.py @@ -364,7 +364,7 @@ class Pdb(bdb.Bdb, cmd.Cmd): bdb.Bdb.__init__(self, skip=skip, backend=backend if backend else get_default_backend()) cmd.Cmd.__init__(self, completekey, stdin, stdout) sys.audit("pdb.Pdb") - if stdin: + if stdin and not getattr(stdin, 'isatty', lambda: False)(): self.use_rawinput = False self.prompt = '(Pdb) ' self.aliases = {}