##// END OF EJS Templates
Merge pull request #1662 from bfroehle/flush_softspace...
Min RK -
r6646:538bc5af merge
parent child Browse files
Show More
@@ -2563,6 +2563,11 b' class InteractiveShell(SingletonConfigurable, Magic):'
2563 code = self.compile(mod, cell_name, "single")
2563 code = self.compile(mod, cell_name, "single")
2564 if self.run_code(code):
2564 if self.run_code(code):
2565 return True
2565 return True
2566
2567 # Flush softspace
2568 if softspace(sys.stdout, 0):
2569 print
2570
2566 except:
2571 except:
2567 # It's possible to have exceptions raised here, typically by
2572 # It's possible to have exceptions raised here, typically by
2568 # compilation of odd code (such as a naked 'return' outside a
2573 # compilation of odd code (such as a naked 'return' outside a
@@ -2622,9 +2627,6 b' class InteractiveShell(SingletonConfigurable, Magic):'
2622 self.showtraceback()
2627 self.showtraceback()
2623 else:
2628 else:
2624 outflag = 0
2629 outflag = 0
2625 if softspace(sys.stdout, 0):
2626 print
2627
2628 return outflag
2630 return outflag
2629
2631
2630 # For backwards compatibility
2632 # For backwards compatibility
@@ -28,6 +28,7 b' from os.path import join'
28 import sys
28 import sys
29 from StringIO import StringIO
29 from StringIO import StringIO
30
30
31 from IPython.testing.decorators import skipif
31 from IPython.utils import io
32 from IPython.utils import io
32
33
33 #-----------------------------------------------------------------------------
34 #-----------------------------------------------------------------------------
@@ -254,6 +255,18 b' class InteractiveShellTestCase(unittest.TestCase):'
254 # ZeroDivisionError
255 # ZeroDivisionError
255 self.assertEqual(ip.var_expand(u"{1/0}"), u"{1/0}")
256 self.assertEqual(ip.var_expand(u"{1/0}"), u"{1/0}")
256
257
258 @skipif(sys.version_info[0] >= 3, "softspace removed in py3")
259 def test_print_softspace(self):
260 """Verify that softspace is handled correctly when executing multiple
261 statements.
262
263 In [1]: print 1; print 2
264 1
265 2
266
267 In [2]: print 1,; print 2
268 1 2
269 """
257
270
258 class TestSafeExecfileNonAsciiPath(unittest.TestCase):
271 class TestSafeExecfileNonAsciiPath(unittest.TestCase):
259
272
General Comments 0
You need to be logged in to leave comments. Login now