Skip to content

Commit f208cba

Browse files
showing source in bpython-curtsies
1 parent 96bf950 commit f208cba

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

bpython/curtsiesfrontend/repl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,10 @@ def process_event(self, e):
366366
self.request_paint_to_clear_screen = True
367367
elif e in key_dispatch[self.config.last_output_key]: #TODO Not Implemented
368368
pass
369-
elif e in ('\x1f',) + key_dispatch[self.config.show_source_key]: #TODO Not Implemented
369+
elif e in ('\x1f',) + key_dispatch[self.config.show_source_key]:
370370
source = self.get_source_of_current_name()
371371
if source is None:
372-
self.status_bar.message('whoops!')
372+
self.status_bar.message(_('Cannot show source.'))
373373
else:
374374
if self.config.highlight_show_source:
375375
source = format(PythonLexer().get_tokens(source), TerminalFormatter())

bpython/repl.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,10 +577,13 @@ def get_source_of_current_name(self):
577577
source cannot be found."""
578578
try:
579579
obj = self.current_func
580+
logging.debug('current func is %r', obj)
580581
if obj is None:
581582
line = self.current_line
582583
if inspection.is_eval_safe_name(line):
583584
obj = self.get_object(line)
585+
if obj is None:
586+
return None
584587
source = inspect.getsource(obj)
585588
except (AttributeError, IOError, NameError, TypeError):
586589
return None

0 commit comments

Comments
 (0)