Skip to content

Commit

Permalink
Merge pull request #333 from giuseppe/ignore-pygiwarnings
Browse files Browse the repository at this point in the history
Ignore PyGIWarning
  • Loading branch information
PCManticore committed Apr 30, 2016
2 parents d272438 + 96dbb79 commit ecb3de0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions astroid/brain/brain_gi.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,17 @@ def _import_gi_module(modname):
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:
Expand Down

0 comments on commit ecb3de0

Please sign in to comment.