[pygobject] [python 3] use the right syntaxis to raise exceptions
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] [python 3] use the right syntaxis to raise exceptions
- Date: Wed, 2 Feb 2011 21:33:44 +0000 (UTC)
commit 09acaff29dfaabc77477cffca2c7137f68991e7f
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Wed Feb 2 21:00:48 2011 +0100
[python 3] use the right syntaxis to raise exceptions
codegen/argtypes.py | 8 ++++----
codegen/definitions.py | 14 +++++++-------
gi/overrides/Gtk.py | 2 +-
3 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/codegen/argtypes.py b/codegen/argtypes.py
index b35f6ef..46e868e 100644
--- a/codegen/argtypes.py
+++ b/codegen/argtypes.py
@@ -79,14 +79,14 @@ class ArgType:
def write_param(self, ptype, pname, pdflt, pnull, info):
"""Add code to the WrapperInfo instance to handle
parameter."""
- raise RuntimeError, "write_param not implemented for %s" % \
- self.__class__.__name__
+ raise RuntimeError("write_param not implemented for %s"
+ % self.__class__.__name__)
def write_return(self, ptype, ownsreturn, info):
"""Adds a variable named ret of the return type to
info.varlist, and add any required code to info.codeafter to
convert the return value to a python object."""
- raise RuntimeError, "write_return not implemented for %s" % \
- self.__class__.__name__
+ raise RuntimeError("write_return not implemented for %s"
+ % self.__class__.__name__)
class NoneArg(ArgType):
def write_return(self, ptype, ownsreturn, info):
diff --git a/codegen/definitions.py b/codegen/definitions.py
index aca5adb..bfb6faf 100644
--- a/codegen/definitions.py
+++ b/codegen/definitions.py
@@ -71,15 +71,15 @@ class Definition(object):
def __init__(self, *args):
"""Create a new defs object of this type. The arguments are the
components of the definition"""
- raise RuntimeError, "this is an abstract class"
+ raise RuntimeError("this is an abstract class")
def merge(self, old):
"""Merge in customisations from older version of definition"""
- raise RuntimeError, "this is an abstract class"
+ raise RuntimeError("this is an abstract class")
def write_defs(self, fp=sys.stdout):
"""write out this definition in defs file format"""
- raise RuntimeError, "this is an abstract class"
+ raise RuntimeError("this is an abstract class")
def guess_return_value_ownership(self):
"return 1 if caller owns return value"
@@ -407,7 +407,7 @@ class MethodDef(MethodDefBase):
for item in ('c_name', 'of_object'):
if self.__dict__[item] == None:
self.write_defs(sys.stderr)
- raise RuntimeError, "definition missing required %s" % (item,)
+ raise RuntimeError("definition missing required %s" % (item,))
def write_defs(self, fp=sys.stdout):
fp.write('(define-method ' + self.name + '\n')
@@ -491,7 +491,7 @@ class FunctionDef(Definition):
for item in ('c_name',):
if self.__dict__[item] == None:
self.write_defs(sys.stderr)
- raise RuntimeError, "definition missing required %s" % (item,)
+ raise RuntimeError("definition missing required %s" % (item,))
_method_write_defs = MethodDef.__dict__['write_defs']
@@ -513,8 +513,8 @@ class FunctionDef(Definition):
else:
param.merge(old_param)
return param
- raise RuntimeError, "could not find %s in old_parameters %r" % (
- param.pname, [p.pname for p in old.params])
+ raise RuntimeError("could not find %s in old_parameters %r" % (
+ param.pname, [p.pname for p in old.params]))
try:
self.params = map(merge_param, self.params)
except RuntimeError:
diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py
index 25a5d92..6c22829 100644
--- a/gi/overrides/Gtk.py
+++ b/gi/overrides/Gtk.py
@@ -591,7 +591,7 @@ class TextBuffer(Gtk.TextBuffer):
for tag in tags:
tag_obj = self.get_tag_table().lookup(tag)
if not tag_obj:
- raise ValueError, 'unknown text tag: ' + tag
+ raise ValueError('unknown text tag: %s' % tag)
tag_objs.append(tag_obj)
self.insert_with_tags(iter, text, *tag_objs)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]