From: david-sarah Date: Sun, 31 Oct 2010 16:06:36 +0000 (-0700) Subject: allmydata/__init__.py: suppress a DeprecationWarning for the sha module on importing... X-Git-Tag: trac-4800~6 X-Git-Url: https://git.rkrishnan.org/pf/content/cyclelanguage?a=commitdiff_plain;h=7e2ed2054cc1ca69a329ad1a2d783f511bb88f43;p=tahoe-lafs%2Ftahoe-lafs.git allmydata/__init__.py: suppress a DeprecationWarning for the sha module on importing pycrypto. --- diff --git a/src/allmydata/__init__.py b/src/allmydata/__init__.py index bfefccbb..96ee8563 100644 --- a/src/allmydata/__init__.py +++ b/src/allmydata/__init__.py @@ -8,6 +8,9 @@ community web site: U{http://tahoe-lafs.org/} # See http://allmydata.org/trac/tahoe/ticket/859 and # http://divmod.org/trac/ticket/2994 . import warnings +warnings.filterwarnings("ignore", category=DeprecationWarning, + message="the sha module is deprecated; use the hashlib module instead", + append=True) warnings.filterwarnings("ignore", category=DeprecationWarning, message="object.__new__\(\) takes no parameters", append=True) @@ -17,9 +20,6 @@ warnings.filterwarnings("ignore", category=DeprecationWarning, warnings.filterwarnings("ignore", category=DeprecationWarning, message="the md5 module is deprecated; use hashlib instead", append=True) -warnings.filterwarnings("ignore", category=DeprecationWarning, - message="the sha module is deprecated; use the hashlib module instead", - append=True) warnings.filterwarnings("ignore", category=DeprecationWarning, message="twisted.web.error.NoResource is deprecated since Twisted 9.0. See twisted.web.resource.NoResource.", append=True) @@ -34,7 +34,9 @@ finally: warnings.filters.pop() warnings.filters.pop() warnings.filters.pop() - warnings.filters.pop() + # Don't pop the filter for the sha module warning because it is also generated + # by pycrypto (which we don't want to import unless needed). + # warnings.filters.pop() # This warning is generated by twisted, PyRex, and possibly other packages, # but can happen at any time, not only when they are imported. See