[Python-checkins] r60925 - in python/trunk/Lib/ctypes: __init__.py macholib/dyld.py test/test_cfuncs.py test/test_macholib.py test/test_random_things.py
thomas.heller
python-checkins at python.org
Thu Feb 21 19:52:20 CET 2008
Author: thomas.heller
Date: Thu Feb 21 19:52:20 2008
New Revision: 60925
Modified:
python/trunk/Lib/ctypes/__init__.py
python/trunk/Lib/ctypes/macholib/dyld.py
python/trunk/Lib/ctypes/test/test_cfuncs.py
python/trunk/Lib/ctypes/test/test_macholib.py
python/trunk/Lib/ctypes/test/test_random_things.py
Log:
Replace 'has_key()' with 'in'.
Replace 'raise Error, stuff' with 'raise Error(stuff)'.
Modified: python/trunk/Lib/ctypes/__init__.py
==============================================================================
--- python/trunk/Lib/ctypes/__init__.py (original)
+++ python/trunk/Lib/ctypes/__init__.py Thu Feb 21 19:52:20 2008
@@ -17,7 +17,7 @@
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 @@
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 @@
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 @@
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
Modified: python/trunk/Lib/ctypes/macholib/dyld.py
==============================================================================
--- python/trunk/Lib/ctypes/macholib/dyld.py (original)
+++ python/trunk/Lib/ctypes/macholib/dyld.py Thu Feb 21 19:52:20 2008
@@ -135,7 +135,7 @@
), 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):
"""
Modified: python/trunk/Lib/ctypes/test/test_cfuncs.py
==============================================================================
--- python/trunk/Lib/ctypes/test/test_cfuncs.py (original)
+++ python/trunk/Lib/ctypes/test/test_cfuncs.py Thu Feb 21 19:52:20 2008
@@ -198,7 +198,7 @@
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
Modified: python/trunk/Lib/ctypes/test/test_macholib.py
==============================================================================
--- python/trunk/Lib/ctypes/test/test_macholib.py (original)
+++ python/trunk/Lib/ctypes/test/test_macholib.py Thu Feb 21 19:52:20 2008
@@ -42,7 +42,7 @@
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":
Modified: python/trunk/Lib/ctypes/test/test_random_things.py
==============================================================================
--- python/trunk/Lib/ctypes/test/test_random_things.py (original)
+++ python/trunk/Lib/ctypes/test/test_random_things.py Thu Feb 21 19:52:20 2008
@@ -3,7 +3,7 @@
def callback_func(arg):
42 / arg
- raise ValueError, arg
+ raise ValueError(arg)
if sys.platform == "win32":
More information about the Python-checkins
mailing list