We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1c218a1 commit dab1ccbCopy full SHA for dab1ccb
bpython/repl.py
@@ -600,7 +600,15 @@ def get_source_of_current_name(self):
600
obj = self.get_object(line)
601
if obj is None:
602
raise NameError("%s is not defined" % line)
603
- return inspect.getsource(obj) #throws an exception that we'll catch
+ try:
604
+ inspect.getsource(obj)
605
+ except TypeError, e:
606
+ msg = e.msg
607
+ if "built-in" in msg:
608
+ msg.split(">")
609
+ raise TypeError("Cannot access source of <built-in function %s>" % self.current_line)
610
+ else:
611
+ raise TypeError("No source code found for %s" % self.current_line)
612
613
def set_docstring(self):
614
self.docstring = None
0 commit comments