##// END OF EJS Templates
Shell's reset method clears namespace from last %run command.
Thomas Kluyver -
Show More
@@ -1038,10 +1038,8 b' class InteractiveShell(Configurable, Magic):'
1038 self.user_ns.update(ns)
1038 self.user_ns.update(ns)
1039
1039
1040 def reset(self, new_session=True):
1040 def reset(self, new_session=True):
1041 """Clear all internal namespaces.
1041 """Clear all internal namespaces, and attempt to release references to
1042
1042 user objects.
1043 Note that this is much more aggressive than %reset, since it clears
1044 fully all namespaces, as well as all input/output lists.
1045
1043
1046 If new_session is True, a new history session will be opened.
1044 If new_session is True, a new history session will be opened.
1047 """
1045 """
@@ -1078,6 +1076,9 b' class InteractiveShell(Configurable, Magic):'
1078 # Flush the private list of module references kept for script
1076 # Flush the private list of module references kept for script
1079 # execution protection
1077 # execution protection
1080 self.clear_main_mod_cache()
1078 self.clear_main_mod_cache()
1079
1080 # Clear out the namespace from the last %run
1081 self.new_main_mod()
1081
1082
1082 def reset_selective(self, regex=None):
1083 def reset_selective(self, regex=None):
1083 """Clear selective variables from internal namespaces based on a
1084 """Clear selective variables from internal namespaces based on a
@@ -10,10 +10,11 b' import sys'
10 class C(object):
10 class C(object):
11 def __init__(self,name):
11 def __init__(self,name):
12 self.name = name
12 self.name = name
13 self.flush_stdout = sys.stdout.flush
13
14
14 def __del__(self):
15 def __del__(self):
15 print 'tclass.py: deleting object:',self.name
16 print 'tclass.py: deleting object:',self.name
16 sys.stdout.flush()
17 self.flush_stdout()
17
18
18 try:
19 try:
19 name = sys.argv[1]
20 name = sys.argv[1]
@@ -202,5 +202,6 b' class TestMagicRunSimple(tt.TempFileMixin):'
202 ARGV 1-: [u'C-first']
202 ARGV 1-: [u'C-first']
203 ARGV 1-: [u'C-second']
203 ARGV 1-: [u'C-second']
204 tclass.py: deleting object: C-first
204 tclass.py: deleting object: C-first
205 tclass.py: deleting object: C-second
205 """
206 """
206 tt.ipexec_validate(self.fname, out)
207 tt.ipexec_validate(self.fname, out)
General Comments 0
You need to be logged in to leave comments. Login now