Some classes defined in C may not have the '__module__' attribute, so we now handle this case to avoid having unexepected AttributeError.