[PATCH 3 of 5] lsprof: use print function

Gregory Szorc gregory.szorc at gmail.com
Sat Jan 2 13:54:45 CST 2016


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1451763653 28800
#      Sat Jan 02 11:40:53 2016 -0800
# Node ID 9c26e94a684bd73ae562eace5264f886119c9280
# Parent  1242b5987618511e0bda9a2d506876c2fd10130c
lsprof: use print function

diff --git a/mercurial/lsprof.py b/mercurial/lsprof.py
--- a/mercurial/lsprof.py
+++ b/mercurial/lsprof.py
@@ -1,9 +1,9 @@
-from __future__ import absolute_import
+from __future__ import absolute_import, print_function
 
 import _lsprof
 import sys
 
 Profiler = _lsprof.Profiler
 
 # PyPy doesn't expose profiler_entry from the module.
 profiler_entry = getattr(_lsprof, 'profiler_entry', None)
@@ -108,14 +108,14 @@ def label(code):
 
     return '%s:%d(%s)' % (mname, code.co_firstlineno, code.co_name)
 
 
 if __name__ == '__main__':
     import os
     sys.argv = sys.argv[1:]
     if not sys.argv:
-        print >> sys.stderr, "usage: lsprof.py <script> <arguments...>"
+        print("usage: lsprof.py <script> <arguments...>", file=sys.stderr)
         sys.exit(2)
     sys.path.insert(0, os.path.abspath(os.path.dirname(sys.argv[0])))
     stats = profile(execfile, sys.argv[0], globals(), locals())
     stats.sort()
     stats.pprint()
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
@@ -93,17 +93,16 @@
   hgext/transplant.py not using absolute_import
   hgext/win32mbcs.py not using absolute_import
   hgext/win32text.py not using absolute_import
   hgext/zeroconf/Zeroconf.py not using absolute_import
   hgext/zeroconf/Zeroconf.py requires print_function
   hgext/zeroconf/__init__.py not using absolute_import
   i18n/check-translation.py not using absolute_import
   i18n/polib.py not using absolute_import
-  mercurial/lsprof.py requires print_function
   mercurial/lsprofcalltree.py requires print_function
   mercurial/mail.py requires print_function
   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


More information about the Mercurial-devel mailing list