@@ -51,7 +51,7 @@ def __init__(self, shell=None, cache_size=1000, **kwargs):
5151
5252 # we need a reference to the user-level namespace
5353 self .shell = shell
54-
54+
5555 self ._ ,self .__ ,self .___ = '' ,'' ,''
5656
5757 # these are deliberately global:
@@ -83,15 +83,9 @@ def check_for_underscore(self):
8383
8484 def quiet (self ):
8585 """Should we silence the display hook because of ';'?"""
86- # do not print output if input ends in ';'
87-
88- try :
89- cell = self .shell .history_manager .input_hist_parsed [- 1 ]
90- except IndexError :
91- # some uses of ipshellembed may fail here
92- return False
93-
94- return self .semicolon_at_end_of_expression (cell )
86+ if self .exec_result is not None :
87+ return self .semicolon_at_end_of_expression (self .exec_result .info .raw_cell )
88+ return False
9589
9690 @staticmethod
9791 def semicolon_at_end_of_expression (expression ):
@@ -280,13 +274,12 @@ def cull_cache(self):
280274 cull_count = max (int (sz * self .cull_fraction ), 2 )
281275 warn ('Output cache limit (currently {sz} entries) hit.\n '
282276 'Flushing oldest {cull_count} entries.' .format (sz = sz , cull_count = cull_count ))
283-
277+
284278 for i , n in enumerate (sorted (oh )):
285279 if i >= cull_count :
286280 break
287281 self .shell .user_ns .pop ('_%i' % n , None )
288282 oh .pop (n , None )
289-
290283
291284 def flush (self ):
292285 if not self .do_full_cache :
0 commit comments