diff options
author | Guido van Rossum <guido@python.org> | 1993-03-29 11:39:45 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1993-03-29 11:39:45 (GMT) |
commit | 0023078a0b751260acdee7be0b029335f7efe888 (patch) | |
tree | a25216272c160b481c0a673a2dfa152097c1f344 /Lib | |
parent | e7113b6b3dd99b4d05fc81c18e1c2a94fa8e1ebb (diff) | |
download | cpython-0023078a0b751260acdee7be0b029335f7efe888.zip cpython-0023078a0b751260acdee7be0b029335f7efe888.tar.gz cpython-0023078a0b751260acdee7be0b029335f7efe888.tar.bz2 |
Added whatis command (third try -- filesystem was full, rcs lock failed)
Diffstat (limited to 'Lib')
-rwxr-xr-x | Lib/pdb.py | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -225,6 +225,30 @@ class Pdb(bdb.Bdb, cmd.Cmd): except KeyboardInterrupt: pass do_l = do_list + + def do_whatis(self, arg): + import codehack + try: + value = eval(arg, self.curframe.f_globals, \ + self.curframe.f_locals) + except: + print '***', sys.exc_type + ':', `sys.exc_value` + return + code = None + # Is it a function? + try: code = value.func_code + except: pass + if code: + print 'Function', codehack.getcodename(code) + return + # Is it an instance method? + try: code = value.im_func.func_code + except: pass + if code: + print 'Method', codehack.getcodename(code) + return + # None of the above... + print type(value) # Print a traceback starting at the top stack frame. # The most recently entered frame is printed last; |