--- a/contrib/memory.py Tue Apr 11 14:54:12 2017 -0700
+++ b/contrib/memory.py Tue Apr 11 14:54:12 2017 -0700
@@ -12,7 +12,6 @@
'''
from __future__ import absolute_import
-import atexit
def memusage(ui):
"""Report memory usage of the current process."""
@@ -29,4 +28,4 @@
for k, v in result.iteritems()]) + "\n")
def extsetup(ui):
- atexit.register(memusage, ui)
+ ui.atexit(memusage, ui)
--- a/mercurial/dispatch.py Tue Apr 11 14:54:12 2017 -0700
+++ b/mercurial/dispatch.py Tue Apr 11 14:54:12 2017 -0700
@@ -7,7 +7,6 @@
from __future__ import absolute_import, print_function
-import atexit
import difflib
import errno
import getopt
@@ -767,7 +766,7 @@
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'):
--- a/mercurial/ui.py Tue Apr 11 14:54:12 2017 -0700
+++ b/mercurial/ui.py Tue Apr 11 14:54:12 2017 -0700
@@ -7,7 +7,6 @@
from __future__ import absolute_import
-import atexit
import collections
import contextlib
import errno
@@ -937,7 +936,7 @@
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)