Patchwork [8,of,8] py3compat: use absolute_import

login
register
mail settings
Submitter Gregory Szorc
Date Dec. 22, 2015, 6 a.m.
Message ID <a1b27c0300484998c2b6.1450764043@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/12230/
State Accepted
Headers show

Comments

Gregory Szorc - Dec. 22, 2015, 6 a.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1450762317 28800
#      Mon Dec 21 21:31:57 2015 -0800
# Node ID a1b27c0300484998c2b69d96ab8b77b622637ba9
# Parent  3af50f2d9359b2491939daa0c89b9e73950c6023
py3compat: use absolute_import
Matt Mackall - Dec. 22, 2015, 10:51 p.m.
On Mon, 2015-12-21 at 22:00 -0800, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc@gmail.com>
> # Date 1450762317 28800
> #      Mon Dec 21 21:31:57 2015 -0800
> # Node ID a1b27c0300484998c2b69d96ab8b77b622637ba9
> # Parent  3af50f2d9359b2491939daa0c89b9e73950c6023
> py3compat: use absolute_import

Queued for default, thanks.

-- 
Mathematics is the supreme nostalgia of our time.

Patch

diff --git a/mercurial/py3kcompat.py b/mercurial/py3kcompat.py
--- a/mercurial/py3kcompat.py
+++ b/mercurial/py3kcompat.py
@@ -1,18 +1,21 @@ 
 # py3kcompat.py - compatibility definitions for running hg in py3k
 #
 # Copyright 2010 Renato Cunha <renatoc@gmail.com>
 #
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
+from __future__ import absolute_import
+
 import builtins
+import numbers
 
-from numbers import Number
+Number = numbers.Number
 
 def bytesformatter(format, args):
     '''Custom implementation of a formatter for bytestrings.
 
     This function currently relies on the string formatter to do the
     formatting and always returns bytes objects.
 
     >>> bytesformatter(20, 10)
diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t
+++ b/tests/test-check-py3-compat.t
@@ -113,17 +113,16 @@ 
   mercurial/keepalive.py requires print_function
   mercurial/localrepo.py not using absolute_import
   mercurial/lsprof.py requires print_function
   mercurial/lsprofcalltree.py not using absolute_import
   mercurial/lsprofcalltree.py requires print_function
   mercurial/mail.py requires print_function
   mercurial/manifest.py not using absolute_import
   mercurial/pvec.py not using absolute_import
-  mercurial/py3kcompat.py not using absolute_import
   setup.py not using absolute_import
   tests/filterpyflakes.py requires print_function
   tests/generate-working-copy-states.py requires print_function
   tests/get-with-headers.py requires print_function
   tests/heredoctest.py requires print_function
   tests/hypothesishelpers.py not using absolute_import
   tests/hypothesishelpers.py requires print_function
   tests/killdaemons.py not using absolute_import