Show More
@@ -983,11 +983,12 b' class InteractiveShell(Configurable, Magic):' | |||
|
983 | 983 | ns.clear() |
|
984 | 984 | |
|
985 | 985 | # The main execution namespaces must be cleared very carefully, |
|
986 |
# skipping the deletion of the |
|
|
987 | # cause errors in many object's __del__ methods. | |
|
986 | # skipping the deletion of the builtin-related keys, because doing so | |
|
987 | # would cause errors in many object's __del__ methods. | |
|
988 | 988 | for ns in [self.user_ns, self.user_global_ns]: |
|
989 | 989 | drop_keys = set(ns.keys()) |
|
990 | 990 | drop_keys.discard('__builtin__') |
|
991 | drop_keys.discard('__builtins__') | |
|
991 | 992 | for k in drop_keys: |
|
992 | 993 | del ns[k] |
|
993 | 994 |
@@ -83,6 +83,22 b' def doctest_run_builtins():' | |||
|
83 | 83 | ....: |
|
84 | 84 | """ |
|
85 | 85 | |
|
86 | def doctest_reset_del(): | |
|
87 | """Test that resetting doesn't cause errors in __del__ methods. | |
|
88 | ||
|
89 | In [2]: class A(object): | |
|
90 | ...: def __del__(self): | |
|
91 | ...: str("Hi") | |
|
92 | ...: | |
|
93 | ||
|
94 | In [3]: a = A() | |
|
95 | ||
|
96 | In [4]: get_ipython().reset() | |
|
97 | ||
|
98 | In [5]: 1+1 | |
|
99 | Out[5]: 2 | |
|
100 | """ | |
|
101 | ||
|
86 | 102 | # For some tests, it will be handy to organize them in a class with a common |
|
87 | 103 | # setup that makes a temp file |
|
88 | 104 |
General Comments 0
You need to be logged in to leave comments.
Login now