]> granicus.if.org Git - python/commitdiff
On 64-bit platforms running test_struct after test_tarfile would fail
authorNeal Norwitz <nnorwitz@gmail.com>
Wed, 31 May 2006 09:02:44 +0000 (09:02 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Wed, 31 May 2006 09:02:44 +0000 (09:02 +0000)
since the deprecation warning wouldn't be raised.

Lib/test/test_struct.py

index da7f40c6bbc00a4aba52ef9c6696d0183b13c4b0..a6c0b4949f8231fd0a9374e293f9c6ab845137f2 100644 (file)
@@ -53,6 +53,12 @@ def deprecated_err(func, *args):
     # The `warnings` module doesn't have an advertised way to restore
     # its filter list.  Cheat.
     save_warnings_filters = warnings.filters[:]
+    # Grrr, we need this function to warn every time.  Without removing
+    # the warningregistry, running test_tarfile then test_struct would fail
+    # on 64-bit platforms.
+    globals = func.func_globals
+    if '__warningregistry__' in globals:
+        del globals['__warningregistry__']
     warnings.filterwarnings("error", r"""^struct.*""", DeprecationWarning)
     warnings.filterwarnings("error", r""".*format requires.*""",
                             DeprecationWarning)