Registers a callback with the standard __exit__ method signature. Can suppress exceptions the same way __exit__ method can. Also accepts any object with an __exit__ method (registering a call to the method instead of the object itself).
(self, exit)
| 503 | return new_stack |
| 504 | |
| 505 | def push(self, exit): |
| 506 | """Registers a callback with the standard __exit__ method signature. |
| 507 | |
| 508 | Can suppress exceptions the same way __exit__ method can. |
| 509 | Also accepts any object with an __exit__ method (registering a call |
| 510 | to the method instead of the object itself). |
| 511 | """ |
| 512 | exit_method = _lookup_special(exit, '__exit__', exit) |
| 513 | self._push_exit_callback(exit_method) |
| 514 | return exit # Allow use as a decorator. |
| 515 | |
| 516 | def enter_context(self, cm): |
| 517 | """Enters the supplied context manager. |
nothing calls this directly
no test coverage detected