Danek Duvall wrote:
Shawn Walker wrote:

http://cr.opensolaris.org/~swalker/pkg-13003/

Is the conversion in error() necessary, given that you're now passing in an
already converted exception into error()?

Also, if this is really a result of python bug 6108, then I wonder if
perhaps the better thing isn't to add __unicode__() methods to our
exception base classes.  But it's not clear to me how this is related to
that.  That bug says that it's the conversion to unicode that's different,
not the conversion to str.  Or am I misreading it?

My guess is that the string becomes unicode because of the _() and some other logic they have in place.

Adding this to the base exception class for this exception:

 55         def __unicode__(self):
 56                 return self.__str__()


...seemed to resolve the issue as well.

I can refocus the bug on a more generic approach for all our exception classes and simply do what I did above for all the base ones. Is that acceptable?

Of course, if that's *not* the issue, it worries me that "%s" % e is not
equivalent to str(e).  Perhaps there was something wrong with the renaming

It isn't because of this bug. Since our exceptions inherit from the base exception class, and due to the changes for python bug 2517, it automatically calls the base class's __unicode__ method to get the stringified version of the exception.

This means that the only way to fix this seems to be the change I suggested above or explicitly calling str() on every exception.

of the "args" member to the "_args" member?

What I know is that under python2.4, "%s" % exception calls __str__ on the exception as expected, and under python2.6, this does not happen for this particular exception case.

I've verified that the _args param is not blame here. In fact, if I change everything to 'params' instead of 'args' and I change the exception class to not pass anything to the base exception init then I get nothing at all -- not even the stringified arguments to the exception.

This seems to mirror the source of where this bug was introduced found attached here:

http://bugs.python.org/issue2517


Cheers,
--
Shawn Walker
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to