##// END OF EJS Templates
%store now prevents storing objs that are in module IPython.FakeModule...
vivainio -
Show More
@@ -1,7 +1,7 b''
1 1 # -*- coding: utf-8 -*-
2 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 7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
@@ -31,6 +31,7 b' import re'
31 31 import tempfile
32 32 import time
33 33 import cPickle as pickle
34 import textwrap
34 35 from cStringIO import StringIO
35 36 from getopt import getopt
36 37 from pprint import pprint, pformat
@@ -2679,7 +2680,16 b' Defaulting color scheme to \'NoColor\'"""'
2679 2680
2680 2681 # default action - store the variable
2681 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 2693 self.shell.persist[ 'S:' + args[0] ] = pickled
2684 2694 print "Stored '%s' (%d bytes)" % (args[0], len(pickled))
2685 2695
@@ -3,6 +3,9 b''
3 3 * Ipython/Extensions/rehash_dir.py: Created a usable example
4 4 of how to extend ipython with new magics. Also added Extensions
5 5 dir to pythonpath to make executing extensions easy.
6
7 * %store now complains when trying to store interactively declared
8 classes / instances of those classes.
6 9
7 10 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
8 11
General Comments 0
You need to be logged in to leave comments. Login now