##// END OF EJS Templates
Backport PR #14198 on branch 8.16.x (Revert "fix semicolon detection with no history") (#14199)...
Matthias Bussonnier -
r28449:ff938669 merge
parent child Browse files
Show More
@@ -51,7 +51,7 b' class DisplayHook(Configurable):'
51 51
52 52 # we need a reference to the user-level namespace
53 53 self.shell = shell
54
54
55 55 self._,self.__,self.___ = '','',''
56 56
57 57 # these are deliberately global:
@@ -83,9 +83,15 b' class DisplayHook(Configurable):'
83 83
84 84 def quiet(self):
85 85 """Should we silence the display hook because of ';'?"""
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
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)
89 95
90 96 @staticmethod
91 97 def semicolon_at_end_of_expression(expression):
@@ -274,12 +280,13 b' class DisplayHook(Configurable):'
274 280 cull_count = max(int(sz * self.cull_fraction), 2)
275 281 warn('Output cache limit (currently {sz} entries) hit.\n'
276 282 'Flushing oldest {cull_count} entries.'.format(sz=sz, cull_count=cull_count))
277
283
278 284 for i, n in enumerate(sorted(oh)):
279 285 if i >= cull_count:
280 286 break
281 287 self.shell.user_ns.pop('_%i' % n, None)
282 288 oh.pop(n, None)
289
283 290
284 291 def flush(self):
285 292 if not self.do_full_cache:
General Comments 0
You need to be logged in to leave comments. Login now