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