Patchwork [1,of,3] py3: silence warning about deprecation of imp module

login
register
mail settings
Submitter Yuya Nishihara
Date April 7, 2018, 5:32 a.m.
Message ID <5f401721fa2a4ba1e5b5.1523079168@mimosa>
Download mbox | patch
Permalink /patch/30515/
State Accepted
Headers show

Comments

Yuya Nishihara - April 7, 2018, 5:32 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1523074919 -32400
#      Sat Apr 07 13:21:59 2018 +0900
# Node ID 5f401721fa2a4ba1e5b5ea570c9c0978481a20f7
# Parent  a0d71618074f3c90180b4e6615544ab20b2cdda4
py3: silence warning about deprecation of imp module

Well, we could fix that, but we aren't yet to reach the state caring about
deprecation on the Python 3 line. So let's silence it for now to fix tons
of "minor" Py2/3 incompatibilities by relying on our test suite.
Pulkit Goyal - April 7, 2018, 9:09 a.m.
On Sat, Apr 7, 2018 at 11:02 AM, Yuya Nishihara <yuya@tcha.org> wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1523074919 -32400
> #      Sat Apr 07 13:21:59 2018 +0900
> # Node ID 5f401721fa2a4ba1e5b5ea570c9c0978481a20f7
> # Parent  a0d71618074f3c90180b4e6615544ab20b2cdda4
> py3: silence warning about deprecation of imp module
>
> Well, we could fix that, but we aren't yet to reach the state caring about
> deprecation on the Python 3 line. So let's silence it for now to fix tons
> of "minor" Py2/3 incompatibilities by relying on our test suite.

I tried fixing that but was unable to find the importlib equivalent.
Silencing the warning for now is good as that will make buildbots
green.

Queued the series. Many thanks.

Patch

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -194,6 +194,9 @@  if _dowarn and pycompat.ispy3:
                             r'mercurial')
     warnings.filterwarnings(r'ignore', r'invalid escape sequence',
                             DeprecationWarning, r'mercurial')
+    # TODO: reinvent imp.is_frozen()
+    warnings.filterwarnings(r'ignore', r'the imp module is deprecated',
+                            DeprecationWarning, r'mercurial')
 
 def nouideprecwarn(msg, version, stacklevel=1):
     """Issue an python native deprecation warning