Re: String exceptions in cxx omniidl backend
Floris Bruynooghe <[email protected]> Mon, 26 Jul 2010 23:39:23 +0100
| Newsgroups | gmane.comp.corba.omniorb.devel |
|---|---|
| Message-ID | <[email protected]> |
--W/nzBZO5zC0uMSeA
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi Duncan
On Sat, Jun 19, 2010 at 12:56:48PM +0100, Duncan Grisby wrote:
> On Thu, 2010-06-17 at 20:14 +0100, Floris Bruynooghe wrote:
>
> > The cxx backend of omniidl still uses string exceptions, which no
> > longer work in Python 2.6
[...]
> As you say, those exceptions are nothing to do with any standards. They
> are in fact essentially all assertion failures. If they are ever
> encountered, it's because of a bug in the omniidl back-end. I'll
> certainly incorporate a patch that removes them, but I'd suggest turning
> them into assertions rather than creating exception classes.
Attached is a patch that does this. It's pretty trivial but it sounds
like that's all required.
Regards
Floris
--
Debian GNU/Linux -- The Power of Freedom
www.debian.org | www.gnu.org | www.kernel.org
--W/nzBZO5zC0uMSeA
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="string_exc.diff"
Index: src/lib/omniORB/omniidl_be/cxx/types.py
===================================================================
--- src/lib/omniORB/omniidl_be/cxx/types.py (revision 5966)
+++ src/lib/omniORB/omniidl_be/cxx/types.py (working copy)
@@ -793,7 +793,7 @@
if d_T.void():
raise NotImplementedError("No such thing as a void _var type")
- raise "Unknown _var type, kind = " + str(d_T.kind())
+ raise AssertionError("Unknown _var type, kind = " + str(d_T.kind()))
def out(self, ident):
if self.is_basic_data_types():
@@ -826,7 +826,8 @@
if d_T.enum() or d_T.void() or (self.is_basic_data_types()):
return ""
- raise "Don't know how to free type, kind = " + str(d_T.kind())
+ raise AssertionError("Don't know how to free type, kind = "
+ + str(d_T.kind()))
def copy(self, src, dest, environment = None):
"""Copies an entity from src to dest"""
@@ -861,7 +862,8 @@
if d_T.enum() or self.is_basic_data_types():
return dest + " = " + src + ";"
- raise "Don't know how to copy type, kind = " + str(d_T.kind())
+ raise AssertionError("Don't know how to copy type, kind = "
+ + str(d_T.kind()))
def representable_by_int(self):
"""representable_by_int(types.Type): boolean
Index: src/lib/omniORB/omniidl_be/cxx/impl/main.py
===================================================================
--- src/lib/omniORB/omniidl_be/cxx/impl/main.py (revision 5966)
+++ src/lib/omniORB/omniidl_be/cxx/impl/main.py (working copy)
@@ -241,7 +241,7 @@
"::" + args)
else:
util.fatalError("Internal error generating interface member")
- raise "No code for interface member: " + repr(c)
+ raise AssertionError("No code for interface member: "+repr(c))
# the class definition has no actual code...
defs = string.join(map(lambda x:x + ";\n", declarations), "")
Index: src/lib/omniORB/omniidl_be/cxx/dynskel/typecode.py
===================================================================
--- src/lib/omniORB/omniidl_be/cxx/dynskel/typecode.py (revision 5966)
+++ src/lib/omniORB/omniidl_be/cxx/dynskel/typecode.py (working copy)
@@ -373,8 +373,8 @@
if isinstance(type, idltype.Base):
util.fatalError("Internal error generating TypeCode data")
- raise "Don't know how to generate TypeCode for Base kind = " +\
- repr(type.kind())
+ raise AssertionError("Don't know how to generate TypeCode for"
+ "Base kind = " + repr(type.kind()))
if isinstance(type, idltype.String):
return prefix + "string_tc(" + str(type.bound()) + tctrack + ")"
Index: src/lib/omniORB/omniidl_be/cxx/ast.py
===================================================================
--- src/lib/omniORB/omniidl_be/cxx/ast.py (revision 5966)
+++ src/lib/omniORB/omniidl_be/cxx/ast.py (working copy)
@@ -349,8 +349,8 @@
if enum not in values: return 0
return 1
- raise "exhaustiveMatch type="+repr(type)+ \
- " val="+repr(discrimvalue)
+ raise AssertionError("exhaustiveMatch type="+repr(type)+
+ " val="+repr(discrimvalue))
# Return the base AST node after following all the typedef chains
--W/nzBZO5zC0uMSeA
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
omniORB-dev mailing list
[email protected]
http://www.omniorb-support.com/mailman/listinfo/omniorb-dev
--W/nzBZO5zC0uMSeA--