From: Serhiy Storchaka Date: Mon, 16 Oct 2017 07:38:14 +0000 (+0300) Subject: bpo-31792: Restore os.environ in test_buffer when import numpy. (#4007) X-Git-Tag: v3.7.0a2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=676db4bbf2e7c18dc7c35add17dd3bbdc2d3eeb3;p=thirdparty%2FPython%2Fcpython.git bpo-31792: Restore os.environ in test_buffer when import numpy. (#4007) --- diff --git a/Lib/test/test_buffer.py b/Lib/test/test_buffer.py index b83f2f107c1c..f302da415d33 100644 --- a/Lib/test/test_buffer.py +++ b/Lib/test/test_buffer.py @@ -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