Georg Brandl added the comment:
It seems to me that retval works quite well, provided you call it in the
frame where the return occurs:
> /home/gbr/devel/python/x.py(2)f()
-> return 123
(Pdb) step
--Return--
> /home/gbr/devel/python/x.py(2)f()->123
-> return 123
(Pdb) retval
123
(Pdb)
New submission from rocky bernstein :
Remove pdb's undocumented"retval"/"rv" debugger commands.
It is conceivable this may have once worked on a version of Python long
ago, but not in recent releases. If it's of interest to make this work,
one approach would be to use the arg parameter passed i