##// END OF EJS Templates
Minor fixes in genutils, and a BIG fix for threading. I _think_ I got...
fperez -
Show More
@@ -4,7 +4,7 b''
4 All the matplotlib support code was co-developed with John Hunter,
4 All the matplotlib support code was co-developed with John Hunter,
5 matplotlib's author.
5 matplotlib's author.
6
6
7 $Id: Shell.py 802 2005-09-06 03:49:12Z fperez $"""
7 $Id: Shell.py 874 2005-09-20 20:13:04Z fperez $"""
8
8
9 #*****************************************************************************
9 #*****************************************************************************
10 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu>
10 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu>
@@ -34,9 +34,6 b' from IPython.Struct import Struct'
34 from IPython.Magic import Magic
34 from IPython.Magic import Magic
35 from IPython import ultraTB
35 from IPython import ultraTB
36
36
37 # global flag to pass around information about Ctrl-C without exceptions
38 KBINT = False
39
40 # global flag to turn on/off Tk support.
37 # global flag to turn on/off Tk support.
41 USE_TK = False
38 USE_TK = False
42
39
@@ -244,18 +241,8 b' class IPShellEmbed:'
244 #-----------------------------------------------------------------------------
241 #-----------------------------------------------------------------------------
245 def sigint_handler (signum,stack_frame):
242 def sigint_handler (signum,stack_frame):
246 """Sigint handler for threaded apps.
243 """Sigint handler for threaded apps.
247
244 """
248 This is a horrible hack to pass information about SIGINT _without_ using
245 raise KeyboardInterrupt
249 exceptions, since I haven't been able to properly manage cross-thread
250 exceptions in GTK/WX. In fact, I don't think it can be done (or at least
251 that's my understanding from a c.l.py thread where this was discussed)."""
252
253 global KBINT
254
255 print '\nKeyboardInterrupt - Press <Enter> to continue.',
256 Term.cout.flush()
257 # Set global flag so that runsource can know that Ctrl-C was hit
258 KBINT = True
259
246
260 class MTInteractiveShell(InteractiveShell):
247 class MTInteractiveShell(InteractiveShell):
261 """Simple multi-threaded shell."""
248 """Simple multi-threaded shell."""
@@ -290,13 +277,6 b' class MTInteractiveShell(InteractiveShell):'
290
277
291 Modified version of code.py's runsource(), to handle threading issues.
278 Modified version of code.py's runsource(), to handle threading issues.
292 See the original for full docstring details."""
279 See the original for full docstring details."""
293
294 global KBINT
295
296 # If Ctrl-C was typed, we reset the flag and return right away
297 if KBINT:
298 KBINT = False
299 return False
300
280
301 try:
281 try:
302 code = self.compile(source, filename, symbol)
282 code = self.compile(source, filename, symbol)
@@ -5,7 +5,7 b' General purpose utilities.'
5 This is a grab-bag of stuff I find useful in most programs I write. Some of
5 This is a grab-bag of stuff I find useful in most programs I write. Some of
6 these things are also convenient when working at the command line.
6 these things are also convenient when working at the command line.
7
7
8 $Id: genutils.py 703 2005-08-16 17:34:44Z fperez $"""
8 $Id: genutils.py 874 2005-09-20 20:13:04Z fperez $"""
9
9
10 #*****************************************************************************
10 #*****************************************************************************
11 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
11 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
@@ -732,7 +732,16 b' def get_home_dir():'
732 "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
732 "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
733 homedir = wreg.QueryValueEx(key,'Personal')[0]
733 homedir = wreg.QueryValueEx(key,'Personal')[0]
734 key.Close()
734 key.Close()
735 if not isdir(homedir):
736 e = ('Invalid "Personal" folder registry key '
737 'typically "My Documents".\n'
738 'Value: %s\n'
739 'This is not a valid directory on your system.' %
740 homedir)
741 raise HomeDirError(e)
735 return homedir
742 return homedir
743 except HomeDirError:
744 raise
736 except:
745 except:
737 return 'C:\\'
746 return 'C:\\'
738 elif os.name == 'dos':
747 elif os.name == 'dos':
@@ -6,7 +6,7 b' Requires Python 2.1 or newer.'
6
6
7 This file contains all the classes and helper functions specific to IPython.
7 This file contains all the classes and helper functions specific to IPython.
8
8
9 $Id: iplib.py 807 2005-09-07 01:55:33Z fperez $
9 $Id: iplib.py 874 2005-09-20 20:13:04Z fperez $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
@@ -959,7 +959,7 b' class InteractiveShell(code.InteractiveConsole, Logger, Magic):'
959 In particular, make sure no Python keywords/builtins are in it."""
959 In particular, make sure no Python keywords/builtins are in it."""
960
960
961 no_alias = self.no_alias
961 no_alias = self.no_alias
962 for k in self.alias_table:
962 for k in self.alias_table.keys():
963 if k in no_alias:
963 if k in no_alias:
964 del self.alias_table[k]
964 del self.alias_table[k]
965 if verbose:
965 if verbose:
@@ -1,3 +1,16 b''
1 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/Shell.py (sigint_handler): Drastic simplification which
4 also seems to make Ctrl-C work correctly across threads! This is
5 so simple, that I can't beleive I'd missed it before. Needs more
6 testing, though.
7
8 * IPython/genutils.py (get_home_dir): add protection against
9 non-dirs in win32 registry.
10
11 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
12 bug where dict was mutated while iterating (pysh crash).
13
1 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
14 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
2
15
3 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
16 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
General Comments 0
You need to be logged in to leave comments. Login now