[PATCH 01 of 10] py3: pass str in os.sysconf()

Pulkit Goyal 7895pulkit at gmail.com
Wed May 31 21:46:57 UTC 2017


# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1496254378 -19800
#      Wed May 31 23:42:58 2017 +0530
# Node ID 111485d5d5a7d2c06a7010b53e111235d5d215fd
# Parent  3b569745af6ca0706b1c289cae49e431731cbd49
py3: pass str in os.sysconf()

os.sysconf() don't accepts bytes on Python 3. Adding r'' will make sure b'' is
not added here.

diff --git a/mercurial/worker.py b/mercurial/worker.py
--- a/mercurial/worker.py
+++ b/mercurial/worker.py
@@ -26,7 +26,7 @@
 
     # posix
     try:
-        n = int(os.sysconf('SC_NPROCESSORS_ONLN'))
+        n = int(os.sysconf(r'SC_NPROCESSORS_ONLN'))
         if n > 0:
             return n
     except (AttributeError, ValueError):


More information about the Mercurial-devel mailing list