##// END OF EJS Templates
%store now prevents storing objs that are in module IPython.FakeModule...
vivainio -
Show More
@@ -1,7 +1,7 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """Magic functions for InteractiveShell.
2 """Magic functions for InteractiveShell.
3
3
4 $Id: Magic.py 1030 2006-01-18 19:24:48Z fperez $"""
4 $Id: Magic.py 1034 2006-01-20 12:59:31Z vivainio $"""
5
5
6 #*****************************************************************************
6 #*****************************************************************************
7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
@@ -31,6 +31,7 b' import re'
31 import tempfile
31 import tempfile
32 import time
32 import time
33 import cPickle as pickle
33 import cPickle as pickle
34 import textwrap
34 from cStringIO import StringIO
35 from cStringIO import StringIO
35 from getopt import getopt
36 from getopt import getopt
36 from pprint import pprint, pformat
37 from pprint import pprint, pformat
@@ -2679,7 +2680,16 b' Defaulting color scheme to \'NoColor\'"""'
2679
2680
2680 # default action - store the variable
2681 # default action - store the variable
2681 else:
2682 else:
2682 pickled = pickle.dumps(self.shell.user_ns[args[0] ])
2683 obj = self.shell.user_ns[args[0] ]
2684 if isinstance(inspect.getmodule(obj), FakeModule):
2685 print textwrap.dedent("""\
2686 Warning:%s is %s
2687 Proper storage of interactively declared classes (or instances
2688 of those classes) is not possible! Only instances
2689 of classes in real modules on file system can be %%store'd.
2690 """ % (args[0], obj) )
2691 return
2692 pickled = pickle.dumps(obj)
2683 self.shell.persist[ 'S:' + args[0] ] = pickled
2693 self.shell.persist[ 'S:' + args[0] ] = pickled
2684 print "Stored '%s' (%d bytes)" % (args[0], len(pickled))
2694 print "Stored '%s' (%d bytes)" % (args[0], len(pickled))
2685
2695
@@ -4,6 +4,9 b''
4 of how to extend ipython with new magics. Also added Extensions
4 of how to extend ipython with new magics. Also added Extensions
5 dir to pythonpath to make executing extensions easy.
5 dir to pythonpath to make executing extensions easy.
6
6
7 * %store now complains when trying to store interactively declared
8 classes / instances of those classes.
9
7 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
10 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
8
11
9 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
12 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
General Comments 0
You need to be logged in to leave comments. Login now