##// 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,49 +1454,44 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
1457 if more:
1458 prompt = self.outputcache.prompt2
1459 if self.autoindent:
1460 self.readline_startup_hook(self.pre_readline)
1461 else:
1462 prompt = self.outputcache.prompt1
1458 1463 try:
1459 if more:
1460 prompt = self.outputcache.prompt2
1461 if self.autoindent:
1462 self.readline_startup_hook(self.pre_readline)
1463 else:
1464 prompt = self.outputcache.prompt1
1465 try:
1466 line = self.raw_input(prompt,more)
1467 if self.autoindent:
1468 self.readline_startup_hook(None)
1469 except EOFError:
1470 if self.autoindent:
1471 self.readline_startup_hook(None)
1472 self.write("\n")
1473 self.exit()
1474 except:
1475 # exceptions here are VERY RARE, but they can be triggered
1476 # asynchronously by signal handlers, for example.
1477 self.showtraceback()
1478 else:
1479 more = self.push(line)
1480
1481 if (self.SyntaxTB.last_syntax_error and
1482 self.rc.autoedit_syntax):
1483 self.edit_syntax_error()
1484
1464 line = self.raw_input(prompt,more)
1465 if self.autoindent:
1466 self.readline_startup_hook(None)
1485 1467 except KeyboardInterrupt:
1486 self.write("\nKeyboardInterrupt\n")
1468 self.write('\nKeyboardInterrupt\n')
1487 1469 self.resetbuffer()
1488 more = 0
1489 1470 # keep cache in sync with the prompt counter:
1490 1471 self.outputcache.prompt_count -= 1
1491 1472
1492 1473 if self.autoindent:
1493 1474 self.indent_current_nsp = 0
1494
1475 more = 0
1476 except EOFError:
1477 if self.autoindent:
1478 self.readline_startup_hook(None)
1479 self.write('\n')
1480 self.exit()
1495 1481 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.")
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.')
1486 except:
1487 # exceptions here are VERY RARE, but they can be triggered
1488 # asynchronously by signal handlers, for example.
1489 self.showtraceback()
1490 else:
1491 more = self.push(line)
1492 if (self.SyntaxTB.last_syntax_error and
1493 self.rc.autoedit_syntax):
1494 self.edit_syntax_error()
1500 1495
1501 1496 # We are off again...
1502 1497 __builtin__.__dict__['__IPYTHON__active'] -= 1
@@ -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