Hide Forgot
Description of problem: pylint doesn't ignore PyGIWarning warnings Version-Release number of selected component (if applicable): python-astroid 1.4.5-1.fc25 How reproducible: 100% Steps to Reproduce: Try pylint on the https://github.com/projectatomic/atomic.git source base Actual results: /usr/lib/python2.7/site-packages/astroid/brain/brain_gi.py:136: PyGIWarning: OSTree was imported without specifying a version first. Use gi.require_version('OSTree', '1.0') before import to ensure that the right version gets loaded. Expected results: not raising any warning Additional info: This patch fixed the problem for me: --- /usr/lib/python2.7/site-packages/astroid/brain/brain_gi.py 2016-03-21 18:23:46.000000000 +0000 +++ /usr/lib/python2.7/site-packages/astroid/brain/brain_gi_new.py 2016-04-26 16:16:42.657432435 +0000 @@ -133,16 +133,17 @@ modcode = '' for m in itertools.chain(modnames, optional_modnames): try: - __import__(m) with warnings.catch_warnings(): # Just inspecting the code can raise gi deprecation # warnings, so ignore them. try: - from gi import PyGIDeprecationWarning + from gi import PyGIDeprecationWarning, PyGIWarning warnings.simplefilter("ignore", PyGIDeprecationWarning) + warnings.simplefilter("ignore", PyGIWarning) except Exception: pass + __import__(m) modcode += _gi_build_stub(sys.modules[m]) except ImportError: if m not in optional_modnames:
Thanks! Could you also submit your patch upstream at: https://github.com/PyCQA/astroid
pull request here: https://github.com/PyCQA/astroid/pull/333