File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -53,10 +53,10 @@ def __delitem__(self, key):
5353 return super ().__delitem__ (key )
5454
5555
56- def _bpython_clear_linecache ():
57- try :
56+ def _bpython_clear_linecache () -> None :
57+ if isinstance ( linecache . cache , BPythonLinecache ) :
5858 bpython_history = linecache .cache .bpython_history
59- except AttributeError :
59+ else :
6060 bpython_history = []
6161 linecache .cache = BPythonLinecache ()
6262 linecache .cache .bpython_history = bpython_history
@@ -68,12 +68,12 @@ def _bpython_clear_linecache():
6868linecache .clearcache = _bpython_clear_linecache
6969
7070
71- def filename_for_console_input (code_string ) :
71+ def filename_for_console_input (code_string : str ) -> str :
7272 """Remembers a string of source code, and returns
7373 a fake filename to use to retrieve it later."""
74- try :
74+ if isinstance ( linecache . cache , BPythonLinecache ) :
7575 return linecache .cache .remember_bpython_input (code_string )
76- except AttributeError :
76+ else :
7777 # If someone else has patched linecache.cache, better for code to
7878 # simply be unavailable to inspect.getsource() than to raise
7979 # an exception.
You can’t perform that action at this time.
0 commit comments