mirror of
https://github.com/python/cpython.git
synced 2025-09-30 04:15:43 +00:00
[3.6] bpo-31792: Restore os.environ in test_buffer when import numpy. (GH-4007) (#4009)
(cherry picked from commit 676db4bbf2
)
This commit is contained in:
parent
cfc604722f
commit
06949585d2
1 changed files with 3 additions and 2 deletions
|
@ -17,7 +17,7 @@ from test import support
|
||||||
from itertools import permutations, product
|
from itertools import permutations, product
|
||||||
from random import randrange, sample, choice
|
from random import randrange, sample, choice
|
||||||
import warnings
|
import warnings
|
||||||
import sys, array, io
|
import sys, array, io, os
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from fractions import Fraction
|
from fractions import Fraction
|
||||||
|
|
||||||
|
@ -37,7 +37,8 @@ except ImportError:
|
||||||
ctypes = None
|
ctypes = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with warnings.catch_warnings():
|
with support.EnvironmentVarGuard() as os.environ, \
|
||||||
|
warnings.catch_warnings():
|
||||||
from numpy import ndarray as numpy_array
|
from numpy import ndarray as numpy_array
|
||||||
except ImportError:
|
except ImportError:
|
||||||
numpy_array = None
|
numpy_array = None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue