From 0529ceca06d7e6a73679d5fe37bc51f28abe6313 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denizhan=20Dak=C4=B1l=C4=B1r?= Date: Mon, 22 Dec 2025 23:47:56 +0300 Subject: [PATCH] Fix readline backend check and stdin isatty condition in cmd and pdb modules --- Lib/cmd.py | 2 +- Lib/pdb.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 = {}