[Yum-devel] [PATCH] Avoid unwanted header loads from RPMInstalledPackage() __getattr__

James Antill james at fedoraproject.org
Thu Feb 17 15:15:17 UTC 2011


On Thu, 2011-02-17 at 17:02 +0200, Panu Matilainen wrote:

> Yeah, you're right... I was somehow under the (wrong) impression that 
> __getattr__() overrides /all/ attribute access, and was a bit baffled by 
> the "if these existed" comments but shrugged it off as "that's probably 
> got something to do with the special _foo attribute tricks :)
> 
> Should it simply be changed to this then?
> 
> -        # starts and ends with __'s. So these are missing.
> -        if varname.startswith('__') and varname.endswith('__'):
> +        # starts with _'s. So these are missing.
> +        if varname.startswith('_'):

 Yeh, probably, with the _get_hdr move.

 Might be worth putting a comment like:

# This stops __foo__ and _blah_cached accesses from loading the header.

...so someone doesn't fix it to explicitly check for __*__ again at some
point :).



More information about the Yum-devel mailing list