]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-31792: Restore os.environ in test_buffer when import numpy. (#4007)
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 16 Oct 2017 07:38:14 +0000 (10:38 +0300)
committerGitHub <noreply@github.com>
Mon, 16 Oct 2017 07:38:14 +0000 (10:38 +0300)
Lib/test/test_buffer.py

index b83f2f107c1c7cb46331b8bbee73514abafb4460..f302da415d33f314fb1c5a057013c52502797df3 100644 (file)
@@ -17,7 +17,7 @@ from test import support
 from itertools import permutations, product
 from random import randrange, sample, choice
 import warnings
-import sys, array, io
+import sys, array, io, os
 from decimal import Decimal
 from fractions import Fraction
 
@@ -37,7 +37,8 @@ except ImportError:
     ctypes = None
 
 try:
-    with warnings.catch_warnings():
+    with support.EnvironmentVarGuard() as os.environ, \
+         warnings.catch_warnings():
         from numpy import ndarray as numpy_array
 except ImportError:
     numpy_array = None