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
d9a9c106
Commit
d9a9c106
authored
Sep 13, 2008
by
Andrew M. Kuchling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update uses of string exceptions
parent
0bef1584
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
9 deletions
+7
-9
Demo/classes/bitvec.py
Demo/classes/bitvec.py
+1
-1
Demo/rpc/rpc.py
Demo/rpc/rpc.py
+3
-3
Demo/scripts/fact.py
Demo/scripts/fact.py
+1
-3
Demo/threads/Coroutine.py
Demo/threads/Coroutine.py
+2
-2
No files found.
Demo/classes/bitvec.py
View file @
d9a9c106
...
...
@@ -21,7 +21,7 @@ def _compute_len(param):
mant
,
l
=
math
.
frexp
(
float
(
param
))
bitmask
=
1L
<<
l
if
bitmask
<=
param
:
raise
'FATAL'
,
'(param, l) = %r'
%
((
param
,
l
),
)
raise
RuntimeError
(
'(param, l) = %r'
%
((
param
,
l
),)
)
while
l
:
bitmask
=
bitmask
>>
1
if
param
&
bitmask
:
...
...
Demo/rpc/rpc.py
View file @
d9a9c106
...
...
@@ -80,9 +80,9 @@ class Packer(xdr.Packer):
# Exceptions
BadRPCFormat
=
'rpc.BadRPCFormat'
BadRPCVersion
=
'rpc.BadRPCVersion'
GarbageArgs
=
'rpc.GarbageArgs'
class
BadRPCFormat
(
Exception
):
pass
class
BadRPCVersion
(
Exception
):
pass
class
GarbageArgs
(
Exception
):
pass
class
Unpacker
(
xdr
.
Unpacker
):
...
...
Demo/scripts/fact.py
View file @
d9a9c106
...
...
@@ -8,10 +8,8 @@
import
sys
from
math
import
sqrt
error
=
'fact.error'
# exception
def
fact
(
n
):
if
n
<
1
:
raise
error
# fact() argument should be >= 1
if
n
<
1
:
raise
ValueError
# fact() argument should be >= 1
if
n
==
1
:
return
[]
# special case
res
=
[]
# Treat even factors special, so we can use i = i+2 later
...
...
Demo/threads/Coroutine.py
View file @
d9a9c106
...
...
@@ -93,8 +93,8 @@ class _CoEvent:
self
.
e
.
wait
()
self
.
e
.
clear
()
Killed
=
'Coroutine.Killed'
EarlyExit
=
'Coroutine.EarlyExit'
class
Killed
(
Exception
):
pass
class
EarlyExit
(
Exception
):
pass
class
Coroutine
:
def
__init__
(
self
):
...
...
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