From a76b701db46154cf8c9a36873a38d52506f17859 2021-03-14 00:48:10 From: Matthias Bussonnier Date: 2021-03-14 00:48:10 Subject: [PATCH] Merge pull request #12848 from meeseeksmachine/auto-backport-of-pr-12844-on-7.x Backport PR #12844 on branch 7.x (Fix UnboundLocalError in IPDB when running 'context' command without argument) --- diff --git a/IPython/core/debugger.py b/IPython/core/debugger.py index 99c83f5..2bf0764 100644 --- a/IPython/core/debugger.py +++ b/IPython/core/debugger.py @@ -805,9 +805,9 @@ class Pdb(OldPdb): new_context = int(context) if new_context <= 0: raise ValueError() + self.context = new_context except ValueError: self.error("The 'context' command requires a positive integer argument.") - self.context = new_context class InterruptiblePdb(Pdb):