Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
f5cbf060
Commit
f5cbf060
authored
Jan 13, 2007
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix pybench so it works -- Larry Hastings.
parent
d713b9ec
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
39 deletions
+41
-39
Tools/pybench/CommandLine.py
Tools/pybench/CommandLine.py
+11
-9
Tools/pybench/Dict.py
Tools/pybench/Dict.py
+2
-2
Tools/pybench/Exceptions.py
Tools/pybench/Exceptions.py
+3
-3
Tools/pybench/Lookups.py
Tools/pybench/Lookups.py
+25
-25
No files found.
Tools/pybench/CommandLine.py
View file @
f5cbf060
...
...
@@ -165,7 +165,7 @@ class Option:
def __init__(self,name,help=None):
if not name[:1] == '
-
':
raise TypeError
,'
option
names
must
start
with
"-"'
raise TypeError
('
option
names
must
start
with
"-"')
if name[1:2] == '
-
':
self.prefix = '
--
'
self.name = name[2:]
...
...
@@ -324,30 +324,32 @@ class Application:
# Append preset options
for option in self.preset_options:
if not
self.option_map.has_key(option.name)
:
if not
option.name in self.option_map
:
self.add_option(option)
# Init .files list
self.files = []
# Start Application
rc = 0
try:
# Process startup
rc = self.startup()
if rc is not None:
raise SystemExit
,rc
raise SystemExit
(rc)
# Parse command line
rc = self.parse()
if rc is not None:
raise SystemExit
,rc
raise SystemExit
(rc)
# Start application
rc = self.main()
if rc is None:
rc = 0
except SystemExit as rc:
except SystemExit as rcException:
rc = rcException
pass
except KeyboardInterrupt:
...
...
@@ -367,7 +369,7 @@ class Application:
print
rc = 1
raise SystemExit
,rc
raise SystemExit
(rc)
def add_option(self, option):
...
...
@@ -398,7 +400,7 @@ class Application:
program. It defaults to 0 which usually means: OK.
"""
raise SystemExit
, rc
raise SystemExit
(rc)
def parse(self):
...
...
@@ -459,7 +461,7 @@ class Application:
except AttributeError:
if value == '':
# count the number of occurances
if
values.has_key(optionname)
:
if
optionname in values
:
values[optionname] = values[optionname] + 1
else:
values[optionname] = 1
...
...
@@ -468,7 +470,7 @@ class Application:
else:
rc = handler(value)
if rc is not None:
raise SystemExit
, rc
raise SystemExit
(rc)
# Apply final file check (for backward compatibility)
rc = self.check_files(self.files)
...
...
Tools/pybench/Dict.py
View file @
f5cbf060
...
...
@@ -351,7 +351,7 @@ class SimpleDictManipulation(Test):
def
test
(
self
):
d
=
{}
has_key
=
d
.
has_key
has_key
=
lambda
key
:
key
in
d
for
i
in
xrange
(
self
.
rounds
):
...
...
@@ -498,7 +498,7 @@ class SimpleDictManipulation(Test):
def
calibrate
(
self
):
d
=
{}
has_key
=
d
.
has_key
has_key
=
lambda
key
:
key
in
d
for
i
in
xrange
(
self
.
rounds
):
pass
Tools/pybench/Exceptions.py
View file @
f5cbf060
...
...
@@ -20,15 +20,15 @@ class TryRaiseExcept(Test):
except
:
pass
try
:
raise
error
,
"something"
raise
error
(
"something"
)
except
:
pass
try
:
raise
error
,
"something"
raise
error
(
"something"
)
except
:
pass
try
:
raise
error
,
"something"
raise
error
(
"something"
)
except
:
pass
try
:
...
...
Tools/pybench/Lookups.py
View file @
f5cbf060
...
...
@@ -774,11 +774,11 @@ class BuiltinMethodLookup(Test):
l
.
sort
l
.
sort
d
.
has_key
d
.
has_key
d
.
has_key
d
.
has_key
d
.
has_key
#
d.has_key
#
d.has_key
#
d.has_key
#
d.has_key
#
d.has_key
d
.
items
d
.
items
...
...
@@ -810,11 +810,11 @@ class BuiltinMethodLookup(Test):
l
.
sort
l
.
sort
d
.
has_key
d
.
has_key
d
.
has_key
d
.
has_key
d
.
has_key
#
d.has_key
#
d.has_key
#
d.has_key
#
d.has_key
#
d.has_key
d
.
items
d
.
items
...
...
@@ -846,11 +846,11 @@ class BuiltinMethodLookup(Test):
l
.
sort
l
.
sort
d
.
has_key
d
.
has_key
d
.
has_key
d
.
has_key
d
.
has_key
#
d.has_key
#
d.has_key
#
d.has_key
#
d.has_key
#
d.has_key
d
.
items
d
.
items
...
...
@@ -882,11 +882,11 @@ class BuiltinMethodLookup(Test):
l
.
sort
l
.
sort
d
.
has_key
d
.
has_key
d
.
has_key
d
.
has_key
d
.
has_key
#
d.has_key
#
d.has_key
#
d.has_key
#
d.has_key
#
d.has_key
d
.
items
d
.
items
...
...
@@ -918,11 +918,11 @@ class BuiltinMethodLookup(Test):
l
.
sort
l
.
sort
d
.
has_key
d
.
has_key
d
.
has_key
d
.
has_key
d
.
has_key
#
d.has_key
#
d.has_key
#
d.has_key
#
d.has_key
#
d.has_key
d
.
items
d
.
items
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment