##// END OF EJS Templates
Fix KeyboardInterrupt trapping (Ctrl-C), which I think I recently broke.
fperez -
Show More
@@ -6,7 +6,7 b' Requires Python 2.3 or newer.'
6 6
7 7 This file contains all the classes and helper functions specific to IPython.
8 8
9 $Id: iplib.py 1099 2006-01-29 21:05:57Z vivainio $
9 $Id: iplib.py 1102 2006-01-30 06:08:16Z fperez $
10 10 """
11 11
12 12 #*****************************************************************************
@@ -1454,8 +1454,6 b' want to merge them back into the new files.""" % locals()'
1454 1454 # exit_now is set by a call to %Exit or %Quit
1455 1455 self.exit_now = False
1456 1456 while not self.exit_now:
1457
1458 try:
1459 1457 if more:
1460 1458 prompt = self.outputcache.prompt2
1461 1459 if self.autoindent:
@@ -1466,38 +1464,35 b' want to merge them back into the new files.""" % locals()'
1466 1464 line = self.raw_input(prompt,more)
1467 1465 if self.autoindent:
1468 1466 self.readline_startup_hook(None)
1467 except KeyboardInterrupt:
1468 self.write('\nKeyboardInterrupt\n')
1469 self.resetbuffer()
1470 # keep cache in sync with the prompt counter:
1471 self.outputcache.prompt_count -= 1
1472
1473 if self.autoindent:
1474 self.indent_current_nsp = 0
1475 more = 0
1469 1476 except EOFError:
1470 1477 if self.autoindent:
1471 1478 self.readline_startup_hook(None)
1472 self.write("\n")
1479 self.write('\n')
1473 1480 self.exit()
1481 except bdb.BdbQuit:
1482 warn('The Python debugger has exited with a BdbQuit exception.\n'
1483 'Because of how pdb handles the stack, it is impossible\n'
1484 'for IPython to properly format this particular exception.\n'
1485 'IPython will resume normal operation.')
1474 1486 except:
1475 1487 # exceptions here are VERY RARE, but they can be triggered
1476 1488 # asynchronously by signal handlers, for example.
1477 1489 self.showtraceback()
1478 1490 else:
1479 1491 more = self.push(line)
1480
1481 1492 if (self.SyntaxTB.last_syntax_error and
1482 1493 self.rc.autoedit_syntax):
1483 1494 self.edit_syntax_error()
1484 1495
1485 except KeyboardInterrupt:
1486 self.write("\nKeyboardInterrupt\n")
1487 self.resetbuffer()
1488 more = 0
1489 # keep cache in sync with the prompt counter:
1490 self.outputcache.prompt_count -= 1
1491
1492 if self.autoindent:
1493 self.indent_current_nsp = 0
1494
1495 except bdb.BdbQuit:
1496 warn("The Python debugger has exited with a BdbQuit exception.\n"
1497 "Because of how pdb handles the stack, it is impossible\n"
1498 "for IPython to properly format this particular exception.\n"
1499 "IPython will resume normal operation.")
1500
1501 1496 # We are off again...
1502 1497 __builtin__.__dict__['__IPYTHON__active'] -= 1
1503 1498
@@ -1762,6 +1757,7 b' want to merge them back into the new files.""" % locals()'
1762 1757 """
1763 1758
1764 1759 line = raw_input_original(prompt)
1760
1765 1761 # Try to be reasonably smart about not re-indenting pasted input more
1766 1762 # than necessary. We do this by trimming out the auto-indent initial
1767 1763 # spaces, if the user's actual input started itself with whitespace.
@@ -1,3 +1,9 b''
1 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/iplib.py (interact): Fix that we were not catching
4 KeyboardInterrupt exceptions properly. I'm not quite sure why the
5 logic here had to change, but it's fixed now.
6
1 7 2006-01-29 Ville Vainio <vivainio@gmail.com>
2 8
3 9 * iplib.py: Try to import pyreadline on Windows.
General Comments 0
You need to be logged in to leave comments. Login now