WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 114506
[ẁebkitpy] Executive.cpu_count() ignores $NUMBER_OF_PROCESSORS
https://bugs.webkit.org/show_bug.cgi?id=114506
Summary
[ẁebkitpy] Executive.cpu_count() ignores $NUMBER_OF_PROCESSORS
Philippe Normand
Reported
2013-04-12 06:27:20 PDT
$NUMBER_OF_PROCESSORS is used in webkitperl, it'd be nice to have support for it in webkitpy too.
Attachments
Patch
(1.48 KB, patch)
2013-04-12 08:43 PDT
,
Manuel Rego Casasnovas
no flags
Details
Formatted Diff
Diff
Patch
(1.52 KB, patch)
2013-04-14 22:40 PDT
,
Manuel Rego Casasnovas
no flags
Details
Formatted Diff
Diff
Patch
(1.46 KB, patch)
2013-04-15 03:35 PDT
,
Manuel Rego Casasnovas
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Manuel Rego Casasnovas
Comment 1
2013-04-12 08:43:36 PDT
Created
attachment 197852
[details]
Patch
Philippe Normand
Comment 2
2013-04-12 08:50:23 PDT
Comment on
attachment 197852
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=197852&action=review
> Tools/Scripts/webkitpy/common/system/executive.py:145 > + if 'NUMBER_OF_PROCESSORS' in os.environ:
This test can be removed. os.environ.get() will return None if the env var is not set, I think.
> Tools/Scripts/webkitpy/common/system/executive.py:150 > + except:
please explicitely catch ValueError :)
Manuel Rego Casasnovas
Comment 3
2013-04-14 22:40:11 PDT
Created
attachment 198023
[details]
Patch os.environ.get() returns None, but None has type NoneType and if you use it in int() it raises a TypeError exception instead of a ValueError. So, I've kept the if checking that the environment variable is defined and then I've added ValueError in the catch clause.
Philippe Normand
Comment 4
2013-04-14 23:55:43 PDT
(In reply to
comment #3
)
> Created an attachment (id=198023) [details] > Patch > > os.environ.get() returns None, but None has type NoneType and if you use it in int() it raises a TypeError exception instead of a ValueError. So, I've kept the if checking that the environment variable is defined and then I've added ValueError in the catch clause.
Well, it's possible to catch multiple exceptions with a single except or even multiple except statements :)
Manuel Rego Casasnovas
Comment 5
2013-04-15 03:35:47 PDT
Created
attachment 198048
[details]
Patch
Zan Dobersek
Comment 6
2013-04-15 04:02:50 PDT
(In reply to
comment #3
)
> Created an attachment (id=198023) [details] > Patch > > os.environ.get() returns None, but None has type NoneType and if you use it in int() it raises a TypeError exception instead of a ValueError. So, I've kept the if checking that the environment variable is defined and then I've added ValueError in the catch clause.
It's possible to define the default value that's to be returned when the searched item is not present in the dictionary. In this case it would probably be 0.
http://docs.python.org/2/library/stdtypes.html#dict.get
Also, mildly interesting, the ẁ (U+1E81) in the [ẁebkitpy] tag in the title does not get reflected in the changelog.
WebKit Commit Bot
Comment 7
2013-04-15 04:06:53 PDT
Comment on
attachment 198048
[details]
Patch Clearing flags on attachment: 198048 Committed
r148429
: <
http://trac.webkit.org/changeset/148429
>
WebKit Commit Bot
Comment 8
2013-04-15 04:06:56 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug