summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2008-02-21 18:52:20 (GMT)
committerThomas Heller <theller@ctypes.org>2008-02-21 18:52:20 (GMT)
commit8982cf5484e0203bc4505cdf13a5f797f477327a (patch)
tree63519e776210ad604081d67b4c80c6f27aaf9c26 /Lib
parent981f31860b87b9d95d5c9c0f91cb574ddaaf2a2a (diff)
downloadcpython-8982cf5484e0203bc4505cdf13a5f797f477327a.zip
cpython-8982cf5484e0203bc4505cdf13a5f797f477327a.tar.gz
cpython-8982cf5484e0203bc4505cdf13a5f797f477327a.tar.bz2
Replace 'has_key()' with 'in'.
Replace 'raise Error, stuff' with 'raise Error(stuff)'.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/ctypes/__init__.py16
-rw-r--r--Lib/ctypes/macholib/dyld.py2
-rw-r--r--Lib/ctypes/test/test_cfuncs.py2
-rw-r--r--Lib/ctypes/test/test_macholib.py2
-rw-r--r--Lib/ctypes/test/test_random_things.py2
5 files changed, 11 insertions, 13 deletions
diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py
index 897f51a..b7b2a58 100644
--- a/Lib/ctypes/__init__.py
+++ b/Lib/ctypes/__init__.py
@@ -17,7 +17,7 @@ from _ctypes import ArgumentError
from struct import calcsize as _calcsize
if __version__ != _ctypes_version:
- raise Exception, ("Version number mismatch", __version__, _ctypes_version)
+ raise Exception("Version number mismatch", __version__, _ctypes_version)
if _os.name in ("nt", "ce"):
from _ctypes import FormatError
@@ -63,7 +63,7 @@ def create_string_buffer(init, size=None):
buftype = c_char * init
buf = buftype()
return buf
- raise TypeError, init
+ raise TypeError(init)
def c_buffer(init, size=None):
## "deprecated, use create_string_buffer instead"
@@ -298,18 +298,16 @@ else:
buftype = c_wchar * init
buf = buftype()
return buf
- raise TypeError, init
+ raise TypeError(init)
POINTER(c_char).from_param = c_char_p.from_param #_SimpleCData.c_char_p_from_param
# XXX Deprecated
def SetPointerType(pointer, cls):
if _pointer_type_cache.get(cls, None) is not None:
- raise RuntimeError, \
- "This type already exists in the cache"
- if not _pointer_type_cache.has_key(id(pointer)):
- raise RuntimeError, \
- "What's this???"
+ raise RuntimeError("This type already exists in the cache")
+ if id(pointer) not in _pointer_type_cache:
+ raise RuntimeError("What's this???")
pointer.set_type(cls)
_pointer_type_cache[cls] = pointer
del _pointer_type_cache[id(pointer)]
@@ -358,7 +356,7 @@ class CDLL(object):
def __getattr__(self, name):
if name.startswith('__') and name.endswith('__'):
- raise AttributeError, name
+ raise AttributeError(name)
func = self.__getitem__(name)
setattr(self, name, func)
return func
diff --git a/Lib/ctypes/macholib/dyld.py b/Lib/ctypes/macholib/dyld.py
index 14e2139..9714ec6 100644
--- a/Lib/ctypes/macholib/dyld.py
+++ b/Lib/ctypes/macholib/dyld.py
@@ -135,7 +135,7 @@ def dyld_find(name, executable_path=None, env=None):
), env):
if os.path.isfile(path):
return path
- raise ValueError, "dylib %s could not be found" % (name,)
+ raise ValueError("dylib %s could not be found" % (name,))
def framework_find(fn, executable_path=None, env=None):
"""
diff --git a/Lib/ctypes/test/test_cfuncs.py b/Lib/ctypes/test/test_cfuncs.py
index 7241006..8f97fc4 100644
--- a/Lib/ctypes/test/test_cfuncs.py
+++ b/Lib/ctypes/test/test_cfuncs.py
@@ -198,7 +198,7 @@ else:
class stdcall_dll(WinDLL):
def __getattr__(self, name):
if name[:2] == '__' and name[-2:] == '__':
- raise AttributeError, name
+ raise AttributeError(name)
func = self._FuncPtr(("s_" + name, self))
setattr(self, name, func)
return func
diff --git a/Lib/ctypes/test/test_macholib.py b/Lib/ctypes/test/test_macholib.py
index 4bb68ac..f2ee035 100644
--- a/Lib/ctypes/test/test_macholib.py
+++ b/Lib/ctypes/test/test_macholib.py
@@ -42,7 +42,7 @@ def find_lib(name):
return os.path.realpath(dyld_find(dylib))
except ValueError:
pass
- raise ValueError, "%s not found" % (name,)
+ raise ValueError("%s not found" % (name,))
class MachOTest(unittest.TestCase):
if sys.platform == "darwin":
diff --git a/Lib/ctypes/test/test_random_things.py b/Lib/ctypes/test/test_random_things.py
index 12b4e62..183b1d6 100644
--- a/Lib/ctypes/test/test_random_things.py
+++ b/Lib/ctypes/test/test_random_things.py
@@ -3,7 +3,7 @@ import unittest, sys
def callback_func(arg):
42 / arg
- raise ValueError, arg
+ raise ValueError(arg)
if sys.platform == "win32":