##// END OF EJS Templates
Work around bug in pprint.pformat. Closes gh-148
Fernando Perez -
Show More
@@ -193,7 +193,11 b' class DisplayHook(Configurable):'
193 """
193 """
194 try:
194 try:
195 if self.shell.pprint:
195 if self.shell.pprint:
196 result_repr = pformat(result)
196 try:
197 result_repr = pformat(result)
198 except:
199 # Work around possible bugs in pformat
200 result_repr = repr(result)
197 if '\n' in result_repr:
201 if '\n' in result_repr:
198 # So that multi-line strings line up with the left column of
202 # So that multi-line strings line up with the left column of
199 # the screen, instead of having the output prompt mess up
203 # the screen, instead of having the output prompt mess up
@@ -163,7 +163,11 b' def result_display(self,arg):'
163 """
163 """
164
164
165 if self.pprint:
165 if self.pprint:
166 out = pformat(arg)
166 try:
167 out = pformat(arg)
168 except:
169 # Work around possible bugs in pformat
170 out = repr(arg)
167 if '\n' in out:
171 if '\n' in out:
168 # So that multi-line strings line up with the left column of
172 # So that multi-line strings line up with the left column of
169 # the screen, instead of having the output prompt mess up
173 # the screen, instead of having the output prompt mess up
General Comments 0
You need to be logged in to leave comments. Login now