diff --git a/Lib/pdb.py b/Lib/pdb.py index b7f6fd4323407e..702058ab5d777a 100644 --- a/Lib/pdb.py +++ b/Lib/pdb.py @@ -1774,6 +1774,9 @@ def _getval(self, arg): try: return eval(arg, self.curframe.f_globals, self.curframe.f_locals) except: + if not arg: + self.error("Missing argument to command!") + raise self._error_exc() raise diff --git a/Misc/NEWS.d/next/Library/2024-11-18-05-53-52.gh-issue-126944.WQv56W.rst b/Misc/NEWS.d/next/Library/2024-11-18-05-53-52.gh-issue-126944.WQv56W.rst new file mode 100644 index 00000000000000..55898098081d54 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-11-18-05-53-52.gh-issue-126944.WQv56W.rst @@ -0,0 +1 @@ +Better error for missing arguments in :mod:`pdb` commands.