Kaydet (Commit) d9a9c106 authored tarafından Andrew M. Kuchling's avatar Andrew M. Kuchling

Update uses of string exceptions

üst 0bef1584
...@@ -21,7 +21,7 @@ def _compute_len(param): ...@@ -21,7 +21,7 @@ def _compute_len(param):
mant, l = math.frexp(float(param)) mant, l = math.frexp(float(param))
bitmask = 1L << l bitmask = 1L << l
if bitmask <= param: if bitmask <= param:
raise 'FATAL', '(param, l) = %r' % ((param, l),) raise RuntimeError('(param, l) = %r' % ((param, l),))
while l: while l:
bitmask = bitmask >> 1 bitmask = bitmask >> 1
if param & bitmask: if param & bitmask:
......
...@@ -80,9 +80,9 @@ class Packer(xdr.Packer): ...@@ -80,9 +80,9 @@ class Packer(xdr.Packer):
# Exceptions # Exceptions
BadRPCFormat = 'rpc.BadRPCFormat' class BadRPCFormat(Exception): pass
BadRPCVersion = 'rpc.BadRPCVersion' class BadRPCVersion(Exception): pass
GarbageArgs = 'rpc.GarbageArgs' class GarbageArgs(Exception): pass
class Unpacker(xdr.Unpacker): class Unpacker(xdr.Unpacker):
......
...@@ -8,10 +8,8 @@ ...@@ -8,10 +8,8 @@
import sys import sys
from math import sqrt from math import sqrt
error = 'fact.error' # exception
def fact(n): 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 if n == 1: return [] # special case
res = [] res = []
# Treat even factors special, so we can use i = i+2 later # Treat even factors special, so we can use i = i+2 later
......
...@@ -93,8 +93,8 @@ class _CoEvent: ...@@ -93,8 +93,8 @@ class _CoEvent:
self.e.wait() self.e.wait()
self.e.clear() self.e.clear()
Killed = 'Coroutine.Killed' class Killed(Exception): pass
EarlyExit = 'Coroutine.EarlyExit' class EarlyExit(Exception): pass
class Coroutine: class Coroutine:
def __init__(self): def __init__(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment