(self)
| 299 | oh.pop(n, None) |
| 300 | |
| 301 | def flush(self): |
| 302 | if not self.do_full_cache: |
| 303 | raise ValueError("You shouldn't have reached the cache flush " |
| 304 | "if full caching is not enabled!") |
| 305 | # delete auto-generated vars from global namespace |
| 306 | |
| 307 | for n in range(1,self.prompt_count + 1): |
| 308 | key = '_'+repr(n) |
| 309 | try: |
| 310 | del self.shell.user_ns_hidden[key] |
| 311 | except KeyError: |
| 312 | pass |
| 313 | try: |
| 314 | del self.shell.user_ns[key] |
| 315 | except KeyError: |
| 316 | pass |
| 317 | # In some embedded circumstances, the user_ns doesn't have the |
| 318 | # '_oh' key set up. |
| 319 | oh = self.shell.user_ns.get('_oh', None) |
| 320 | if oh is not None: |
| 321 | oh.clear() |
| 322 | |
| 323 | # Release our own references to objects: |
| 324 | self._, self.__, self.___ = '', '', '' |
| 325 | |
| 326 | if '_' not in builtin_mod.__dict__: |
| 327 | self.shell.user_ns.update({'_':self._,'__':self.__,'___':self.___}) |
| 328 | import gc |
| 329 | # TODO: Is this really needed? |
| 330 | # IronPython blocks here forever |
| 331 | if sys.platform != "cli": |
| 332 | gc.collect() |
| 333 | |
| 334 | |
| 335 | class CapturingDisplayHook: |
no test coverage detected