# HG changeset patch # User Bryan O'Sullivan # Date 2017-04-11 21:54:12 # Node ID de5c9d0e02ea9362447c8864fb457faec2f6e719 # Parent 84f9eb9758c0fdbe3bf4f1bff5254c10e15c4d13 atexit: switch to home-grown implementation diff --git a/contrib/memory.py b/contrib/memory.py --- a/contrib/memory.py +++ b/contrib/memory.py @@ -12,7 +12,6 @@ prints it to ``stderr`` on exit. ''' from __future__ import absolute_import -import atexit def memusage(ui): """Report memory usage of the current process.""" @@ -29,4 +28,4 @@ def memusage(ui): for k, v in result.iteritems()]) + "\n") def extsetup(ui): - atexit.register(memusage, ui) + ui.atexit(memusage, ui) diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -7,7 +7,6 @@ from __future__ import absolute_import, print_function -import atexit import difflib import errno import getopt @@ -767,7 +766,7 @@ def _dispatch(req): ui.warn( _("time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") % (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3])) - atexit.register(print_time) + ui.atexit(print_time) if options['verbose'] or options['debug'] or options['quiet']: for opt in ('verbose', 'debug', 'quiet'): diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -7,7 +7,6 @@ from __future__ import absolute_import -import atexit import collections import contextlib import errno @@ -937,7 +936,7 @@ class ui(object): if self._isatty(util.stderr): os.dup2(pager.stdin.fileno(), util.stderr.fileno()) - @atexit.register + @self.atexit def killpager(): if util.safehasattr(signal, "SIGINT"): signal.signal(signal.SIGINT, signal.SIG_IGN)