|
14 | 14 | from struct import calcsize as _calcsize |
15 | 15 |
|
16 | 16 | if __version__ != _ctypes_version: |
17 | | - raise Exception, ("Version number mismatch", __version__, _ctypes_version) |
| 17 | + raise Exception("Version number mismatch", __version__, _ctypes_version) |
18 | 18 |
|
19 | 19 | if _os.name in ("nt", "ce"): |
20 | 20 | from _ctypes import FormatError |
@@ -67,7 +67,7 @@ def create_string_buffer(init, size=None): |
67 | 67 | buftype = c_char * init |
68 | 68 | buf = buftype() |
69 | 69 | return buf |
70 | | - raise TypeError, init |
| 70 | + raise TypeError(init) |
71 | 71 |
|
72 | 72 | def c_buffer(init, size=None): |
73 | 73 | ## "deprecated, use create_string_buffer instead" |
@@ -297,18 +297,16 @@ def create_unicode_buffer(init, size=None): |
297 | 297 | buftype = c_wchar * init |
298 | 298 | buf = buftype() |
299 | 299 | return buf |
300 | | - raise TypeError, init |
| 300 | + raise TypeError(init) |
301 | 301 |
|
302 | 302 | POINTER(c_char).from_param = c_char_p.from_param #_SimpleCData.c_char_p_from_param |
303 | 303 |
|
304 | 304 | # XXX Deprecated |
305 | 305 | def SetPointerType(pointer, cls): |
306 | 306 | if _pointer_type_cache.get(cls, None) is not None: |
307 | | - raise RuntimeError, \ |
308 | | - "This type already exists in the cache" |
| 307 | + raise RuntimeError("This type already exists in the cache") |
309 | 308 | if id(pointer) not in _pointer_type_cache: |
310 | | - raise RuntimeError, \ |
311 | | - "What's this???" |
| 309 | + raise RuntimeError("What's this???") |
312 | 310 | pointer.set_type(cls) |
313 | 311 | _pointer_type_cache[cls] = pointer |
314 | 312 | del _pointer_type_cache[id(pointer)] |
@@ -357,7 +355,7 @@ def __repr__(self): |
357 | 355 |
|
358 | 356 | def __getattr__(self, name): |
359 | 357 | if name.startswith('__') and name.endswith('__'): |
360 | | - raise AttributeError, name |
| 358 | + raise AttributeError(name) |
361 | 359 | func = self.__getitem__(name) |
362 | 360 | setattr(self, name, func) |
363 | 361 | return func |
|
0 commit comments