#326 default for a keyword argument in resolve_dependencies_ugly causes the method to raise exceptions
Closed: Fixed Opened by thomasvs.

In misc.py, there is:
{{{
def resolve_dependencies_ugly(yumobj, logger = None, pbar = None):
def get_package_deps(po):
"""Add the dependencies for a given package to the
transaction info"""

    if not logger == None:
        logger.debug(_("Checking dependencies for %s.%s") % (po.name, po.arch), level = 8)

}}}

and later on
{{{
if not deps:
if not pbar == None:
pbar.cur_task += 1.0
logger.warning(_("Unresolvable dependency %s %s %s in %s.%s") % (r, f, v, po.name, po.arch))
}}}

Notice how in the first use of logger, a check for None is made (which would be more pythonicly written as if logger is None). Later on, this never gets done, so if the default of None is used, the code will traceback. Have run into this at runtime.

I don't think it would be good to do the if check at every time anyway; that just makes the code ugly. I suggest creating a fake logger object if logger is None, or enforcing that there always should be a real logger.
}}}


Fixed in GIT (testing now), thanks

Fixed in GIT (testing now), thanks

Metadata