Registers an arbitrary callback and arguments. Cannot suppress exceptions.
(self, callback, /, *args, **kwds)
| 532 | return result |
| 533 | |
| 534 | def callback(self, callback, /, *args, **kwds): |
| 535 | """Registers an arbitrary callback and arguments. |
| 536 | |
| 537 | Cannot suppress exceptions. |
| 538 | """ |
| 539 | _exit_wrapper = self._create_cb_wrapper(callback, *args, **kwds) |
| 540 | |
| 541 | # We changed the signature, so using @wraps is not appropriate, but |
| 542 | # setting __wrapped__ may still help with introspection. |
| 543 | _exit_wrapper.__wrapped__ = callback |
| 544 | self._push_exit_callback(_exit_wrapper) |
| 545 | return callback # Allow use as a decorator |
| 546 | |
| 547 | def _push_cm_exit(self, cm, cm_exit): |
| 548 | """Helper to correctly register callbacks to __exit__ methods.""" |
nothing calls this directly
no test coverage detected