(self)
| 283 | |
| 284 | |
| 285 | def flush(self): |
| 286 | if not self.do_full_cache: |
| 287 | raise ValueError("You shouldn't have reached the cache flush " |
| 288 | "if full caching is not enabled!") |
| 289 | # delete auto-generated vars from global namespace |
| 290 | |
| 291 | for n in range(1,self.prompt_count + 1): |
| 292 | key = '_'+repr(n) |
| 293 | try: |
| 294 | del self.shell.user_ns[key] |
| 295 | except: pass |
| 296 | # In some embedded circumstances, the user_ns doesn't have the |
| 297 | # '_oh' key set up. |
| 298 | oh = self.shell.user_ns.get('_oh', None) |
| 299 | if oh is not None: |
| 300 | oh.clear() |
| 301 | |
| 302 | # Release our own references to objects: |
| 303 | self._, self.__, self.___ = '', '', '' |
| 304 | |
| 305 | if '_' not in builtin_mod.__dict__: |
| 306 | self.shell.user_ns.update({'_':self._,'__':self.__,'___':self.___}) |
| 307 | import gc |
| 308 | # TODO: Is this really needed? |
| 309 | # IronPython blocks here forever |
| 310 | if sys.platform != "cli": |
| 311 | gc.collect() |
| 312 | |
| 313 | |
| 314 | class CapturingDisplayHook(object): |
no test coverage detected