[master][PATCH] Fix checking if we are collecting our module

David Shea dshea at redhat.com
Tue Dec 10 20:56:17 UTC 2013


On 12/10/2013 09:27 AM, Chris Lumens wrote:
>> diff --git a/pyanaconda/ui/common.py b/pyanaconda/ui/common.py
>> index 627ae75..f85a144 100644
>> --- a/pyanaconda/ui/common.py
>> +++ b/pyanaconda/ui/common.py
>> @@ -558,6 +558,7 @@ def collect(module_pattern, path, pred):
>>   
>>           mod_info = None
>>           module = None
>> +        module_path = None
>>   
>>           try:
>>               imp.acquire_lock()
>> @@ -627,7 +628,7 @@ def collect(module_pattern, path, pred):
>>               continue
>>   
>>           except ImportError as imperr:
>> -            if "pyanaconda" in module_path:
>> +            if module_path and "pyanaconda" in module_path:
>>                   # failure when importing our own module:
>>                   raise
>>               log.error("Failed to import module in collect: %s", imperr)
> Any idea why I've not seen this caught by pylint?
>
> - Chris
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
There's an open issue about this: 
https://bitbucket.org/logilab/pylint/issue/85/pylint-does-not-recognize-potential. 
There's also an issue linked in the comments about variables defined in 
an if statement.

It might be possible to catch these cases with pylint modules in the 
meantime, but variables.py is pretty gnarly and trying to make sense of 
what all's going on and what could be added is a bit of a chore.


More information about the anaconda-patches mailing list