Mercurial > public > mercurial-scm > hg
comparison mercurial/worker.py @ 32611:954489932c4f
py3: pass str in os.sysconf()
os.sysconf() doesn't accepts bytes on Python 3. Adding r'' will make
sure b'' is not added here.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 31 May 2017 23:42:58 +0530 |
parents | 31763785094b |
children | 75979c8d4572 |
comparison
equal
deleted
inserted
replaced
32610:bf728e72a219 | 32611:954489932c4f |
---|---|
24 def countcpus(): | 24 def countcpus(): |
25 '''try to count the number of CPUs on the system''' | 25 '''try to count the number of CPUs on the system''' |
26 | 26 |
27 # posix | 27 # posix |
28 try: | 28 try: |
29 n = int(os.sysconf('SC_NPROCESSORS_ONLN')) | 29 n = int(os.sysconf(r'SC_NPROCESSORS_ONLN')) |
30 if n > 0: | 30 if n > 0: |
31 return n | 31 return n |
32 except (AttributeError, ValueError): | 32 except (AttributeError, ValueError): |
33 pass | 33 pass |
34 | 34 |