Commit ec2e882b authored by Kirill Smelkov's avatar Kirill Smelkov

*: Suppress DeprecationWarning on `import imp`

As of 20191107 imp is present in Python 3.8 source tree and is _used_
there - see e.g.

    https://github.com/python/cpython/blob/v3.8.0-66-g7c20888e713/Lib/pkgutil.py#L188-L192

And they say imp will be there until at least Python 4 - see e.g.

    https://github.com/python/cpython/commit/e4f41deccf94

This fixes test_defer_excchain_dump failure under python3-dbg, where

E           Failed: not equal:
E           Differences (unified diff with -expected +actual):
E               @@ -1,4 +1,6 @@
E               +PYGOLANG/golang/_gopath.py:37: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
E               +  import imp

was added into traceback printed on stderr.

Fixes: bb9a94c3 (golang: Teach defer to chain exceptions (PEP 3134) even on Python2)
parent b073f6df
......@@ -34,7 +34,11 @@ from __future__ import print_function, absolute_import
import os, os.path
import sys
import imp
import warnings
with warnings.catch_warnings():
warnings.simplefilter('ignore', DeprecationWarning)
import imp
# _gopathv returns $GOPATH vector.
def _gopathv():
......
......@@ -34,7 +34,11 @@ trun cares to run python with LD_PRELOAD set appropriately to /path/to/libtsan.s
from __future__ import print_function, absolute_import
import os, sys, re, subprocess, imp, pkgutil
import os, sys, re, subprocess, pkgutil
import warnings
with warnings.catch_warnings():
warnings.simplefilter('ignore', DeprecationWarning)
import imp
PY3 = (bytes is not str)
# env_prepend prepends value to ${name} environment variable.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment