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

Panu Matilainen pmatilai at laiskiainen.org
Thu Feb 17 16:36:45 UTC 2011


On 02/17/2011 05:15 PM, James Antill wrote:
> 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 :).

Okay, will do.

	- Panu -


More information about the Yum-devel mailing list