summaryrefslogtreecommitdiff
path: root/numpy/testing/_private/utils.py
diff options
context:
space:
mode:
authorPieter Eendebak <pieter.eendebak@gmail.com>2022-08-23 08:55:56 +0200
committerGitHub <noreply@github.com>2022-08-23 08:55:56 +0200
commitacdd0e3ffff0db9f45951c6b51887937ca31935e (patch)
treeda6807ee3f96b484dcd1e96da53538953cb31653 /numpy/testing/_private/utils.py
parent8d45b9b33c9957c816cde9f630c5f418224ac5d6 (diff)
downloadnumpy-acdd0e3ffff0db9f45951c6b51887937ca31935e.tar.gz
PERF: Eliminate slow check for pypy during numpy import (#22163)
This PR replaces the import of platform and a call to platform.python_implementation() with a check using sys.implementation.name to improve the numpy import time. The improvement is about 5-10 ms (system dependent). Also see #22061 Co-authored-by: Matti Picus <matti.picus@gmail.com>
Diffstat (limited to 'numpy/testing/_private/utils.py')
-rw-r--r--numpy/testing/_private/utils.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/numpy/testing/_private/utils.py b/numpy/testing/_private/utils.py
index c553658cb..26b2aac4d 100644
--- a/numpy/testing/_private/utils.py
+++ b/numpy/testing/_private/utils.py
@@ -48,7 +48,7 @@ class KnownFailureException(Exception):
KnownFailureTest = KnownFailureException # backwards compat
verbose = 0
-IS_PYPY = platform.python_implementation() == 'PyPy'
+IS_PYPY = sys.implementation.name == 'pypy'
IS_PYSTON = hasattr(sys, "pyston_version_info")
HAS_REFCOUNT = getattr(sys, 'getrefcount', None) is not None and not IS_PYSTON
HAS_LAPACK64 = numpy.linalg.lapack_lite._ilp64