[Yum-devel] [PATCH] YumRPMTransError: "errors" should not end up in e.value. BZ 966372

Zdenek Pavlas zpavlas at redhat.com
Fri May 24 08:35:54 UTC 2013


>  As always the big problem is that this is a significant API change for
> yum, so we'd need to somehow audit every piece of code that ever used
> yum and make sure this doesn't affect them negatively.
>  I'd guess that it probably doesn't, but it's much easier to just know
> it doesn't because we didn't API break anything.

I understand this.  Found only one user of this in Yum,
and it's not likely used by any plugin.

> > reproducer:
> > >>> e = yum.Errors.YumRPMTransError('Foo', [])
> > >>> yum.i18n.exception2msg(e.value)
> 
>  Why call exception2msg(e.value) ? Does any code actually do that?
>  exception2msg(e) works, right?

    def exFatal(e):
        logger.critical('\n\n%s', exception2msg(e.value))
        if unlock(): return 200
        return 1

Here it's probably a (another) bug, should be exception2msg(e), but
exception2msg() getattrs value first, too:

def exception2msg(e):
    try:
        return to_unicode(e.value)
    ...

to_unicode() simply returns the arg when it's a list.  And I'd rather
not touch this, since exception2msg() and to_unicode() are used a lot.


More information about the Yum-devel mailing list