##// 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
@@ -83,10 +83,16 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)
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
88 92 return False
89 93
94 return self.semicolon_at_end_of_expression(cell)
95
90 96 @staticmethod
91 97 def semicolon_at_end_of_expression(expression):
92 98 """Parse Python expression and detects whether last token is ';'"""
@@ -281,6 +287,7 b' class DisplayHook(Configurable):'
281 287 self.shell.user_ns.pop('_%i' % n, None)
282 288 oh.pop(n, None)
283 289
290
284 291 def flush(self):
285 292 if not self.do_full_cache:
286 293 raise ValueError("You shouldn't have reached the cache flush "
General Comments 0
You need to be logged in to leave comments. Login now