|  | @@ -232,10 +232,15 @@ def _is_magic_module(m):
 | 
	
		
			
				|  |  |      # will load _tkinter and other shit when touched.
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      # pyflakes refuses to accept 'noqa' for this isinstance.
 | 
	
		
			
				|  |  | -    cls, modtype = getattr(m, '__class__', None), types.ModuleType
 | 
	
		
			
				|  |  | -    return (cls is not modtype and (
 | 
	
		
			
				|  |  | -        '__getattr__' in vars(m.__class__) or
 | 
	
		
			
				|  |  | -        '__getattribute__' in vars(m.__class__)))
 | 
	
		
			
				|  |  | +    cls, modtype = type(m), types.ModuleType
 | 
	
		
			
				|  |  | +    try:
 | 
	
		
			
				|  |  | +        variables = vars(cls)
 | 
	
		
			
				|  |  | +    except TypeError:
 | 
	
		
			
				|  |  | +        return True
 | 
	
		
			
				|  |  | +    else:
 | 
	
		
			
				|  |  | +        return (cls is not modtype and (
 | 
	
		
			
				|  |  | +            '__getattr__' in variables or
 | 
	
		
			
				|  |  | +            '__getattribute__' in variables))
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  class _AssertWarnsContext(_AssertRaisesBaseContext):
 |