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

login
register
mail settings
Submitter Pulkit Goyal
Date May 31, 2017, 9:46 p.m.
Message ID <111485d5d5a7d2c06a70.1496267217@workspace>
Download mbox | patch
Permalink /patch/21096/
State Accepted
Headers show

Comments

Pulkit Goyal - May 31, 2017, 9:46 p.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@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.

Patch

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):