def test_register(): def foobar(): pass atexit.register(foobar) atexit.unregister(foobar) atexit.unregister(foobar)
def test_prog_unregister(): from ddtrace.internal import atexit def foobar(): print("hello") atexit.register(foobar) atexit.unregister(foobar)
def stop(self, flush=True): """Stop the profiler. :param flush: Flush last profile. """ atexit.unregister(self.stop) try: self._profiler.stop(flush) except service.ServiceStatusError: # Not a best practice, but for backward API compatibility that allowed to call `stop` multiple times. pass