summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrigitta Sipőcz <bsipocz@gmail.com>2022-05-20 18:34:06 -0700
committerBrigitta Sipőcz <bsipocz@gmail.com>2022-05-23 09:29:59 -0700
commitd4d5771e17c14ce8cdeaf2922d537006dd3fcebf (patch)
tree0e46316f3143350dd14602ebea42f06a4c5864c1
parent53379cd353fb7ab5840c3ee370c735fe61d6419c (diff)
downloadnumpy-d4d5771e17c14ce8cdeaf2922d537006dd3fcebf.tar.gz
MAINT: Python <3.8 related cleanups
-rw-r--r--azure-pipelines.yml28
-rw-r--r--doc/source/dev/development_environment.rst4
-rw-r--r--doc/source/f2py/code/CMakeLists.txt4
-rw-r--r--doc/source/f2py/code/CMakeLists_skbuild.txt2
-rw-r--r--doc/source/user/absolute_beginners.rst2
-rw-r--r--numpy/core/tests/test_regression.py2
-rw-r--r--numpy/distutils/misc_util.py7
-rw-r--r--numpy/testing/tests/test_utils.py20
-rw-r--r--numpy/tests/test_scripts.py4
-rw-r--r--numpy/typing/tests/data/pass/array_constructors.py5
-rw-r--r--numpy/typing/tests/data/pass/scalars.py7
-rw-r--r--tools/find_deprecated_escaped_characters.py2
-rw-r--r--tox.ini4
13 files changed, 26 insertions, 65 deletions
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 0e7e097db..761da0833 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -299,31 +299,3 @@ stages:
testResultsFiles: '**/test-*.xml'
failTaskOnFailedTests: true
testRunTitle: 'Publish test results for conda installation'
-
-
- #- job: Linux_gcc48
- #pool:
- ## ubuntu-20.04 does not provide a gcc-4.8 package
- #vmImage: 'ubuntu-18.04'
- #steps:
- #- script: |
- #sudo apt update
- #sudo apt install python3.7
- #sudo apt install python3.7-dev
- #if ! `gcc-4.8 2>/dev/null`; then
- #sudo apt install gcc-4.8
- #fi
- #displayName: 'add gcc 4.8'
- #- script: |
- ## python3 has no setuptools, so install one to get us going
- #python3.7 -m pip install --user --upgrade pip 'setuptools<49.2.0'
- #python3.7 -m pip install --user -r test_requirements.txt
- #CPPFLAGS='' CC=gcc-4.8 F77=gfortran-5 F90=gfortran-5 \
- #python3.7 runtests.py --debug-info --mode=full -- -rsx --junitxml=junit/test-results.xml
- #displayName: 'Run gcc4.8 Build / Tests'
- #- task: PublishTestResults@2
- #condition: succeededOrFailed()
- #inputs:
- #testResultsFiles: '**/test-*.xml'
- #failTaskOnFailedTests: true
- #testRunTitle: 'Publish test results for gcc 4.8'
diff --git a/doc/source/dev/development_environment.rst b/doc/source/dev/development_environment.rst
index 1d6e71b6d..4772366d2 100644
--- a/doc/source/dev/development_environment.rst
+++ b/doc/source/dev/development_environment.rst
@@ -194,9 +194,9 @@ That also takes extra arguments, like ``--pdb`` which drops you into the Python
debugger when a test fails or an exception is raised.
Running tests with `tox`_ is also supported. For example, to build NumPy and
-run the test suite with Python 3.7, use::
+run the test suite with Python 3.9, use::
- $ tox -e py37
+ $ tox -e py39
For more extensive information, see :ref:`testing-guidelines`
diff --git a/doc/source/f2py/code/CMakeLists.txt b/doc/source/f2py/code/CMakeLists.txt
index d16ddf77e..6f5170ad5 100644
--- a/doc/source/f2py/code/CMakeLists.txt
+++ b/doc/source/f2py/code/CMakeLists.txt
@@ -14,8 +14,8 @@ if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
)
endif()
-# Grab Python, 3.7 or newer
-find_package(Python 3.7 REQUIRED
+# Grab Python, 3.8 or newer
+find_package(Python 3.8 REQUIRED
COMPONENTS Interpreter Development.Module NumPy)
# Grab the variables from a local Python installation
diff --git a/doc/source/f2py/code/CMakeLists_skbuild.txt b/doc/source/f2py/code/CMakeLists_skbuild.txt
index 3d092760b..f2d6b69c1 100644
--- a/doc/source/f2py/code/CMakeLists_skbuild.txt
+++ b/doc/source/f2py/code/CMakeLists_skbuild.txt
@@ -17,7 +17,7 @@ endif()
# Ensure scikit-build modules
if (NOT SKBUILD)
- find_package(PythonInterp 3.7 REQUIRED)
+ find_package(PythonInterp 3.8 REQUIRED)
# Kanged --> https://github.com/Kitware/torch_liberator/blob/master/CMakeLists.txt
# If skbuild is not the driver; include its utilities in CMAKE_MODULE_PATH
execute_process(
diff --git a/doc/source/user/absolute_beginners.rst b/doc/source/user/absolute_beginners.rst
index cf11c6745..a4a82afb6 100644
--- a/doc/source/user/absolute_beginners.rst
+++ b/doc/source/user/absolute_beginners.rst
@@ -1344,7 +1344,7 @@ followed by the docstring of ``ndarray`` of which ``a`` is an instance):
Type: ndarray
String form: [1 2 3 4 5 6]
Length: 6
- File: ~/anaconda3/lib/python3.7/site-packages/numpy/__init__.py
+ File: ~/anaconda3/lib/python3.9/site-packages/numpy/__init__.py
Docstring: <no docstring>
Class docstring:
ndarray(shape, dtype=float, buffer=None, offset=0,
diff --git a/numpy/core/tests/test_regression.py b/numpy/core/tests/test_regression.py
index 937dcb93e..98e0df9b8 100644
--- a/numpy/core/tests/test_regression.py
+++ b/numpy/core/tests/test_regression.py
@@ -2480,8 +2480,6 @@ class TestRegression:
assert arr.shape == (1, 0, 0)
@pytest.mark.skipif(sys.maxsize < 2 ** 31 + 1, reason='overflows 32-bit python')
- @pytest.mark.skipif(sys.platform == 'win32' and sys.version_info[:2] < (3, 8),
- reason='overflows on windows, fixed in bpo-16865')
def test_to_ctypes(self):
#gh-14214
arr = np.zeros((2 ** 31 + 1,), 'b')
diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py
index 42bf807d1..78665d351 100644
--- a/numpy/distutils/misc_util.py
+++ b/numpy/distutils/misc_util.py
@@ -2348,11 +2348,7 @@ def generate_config_py(target):
extra_dll_dir = os.path.join(os.path.dirname(__file__), '.libs')
if sys.platform == 'win32' and os.path.isdir(extra_dll_dir):
- if sys.version_info >= (3, 8):
- os.add_dll_directory(extra_dll_dir)
- else:
- os.environ.setdefault('PATH', '')
- os.environ['PATH'] += os.pathsep + extra_dll_dir
+ os.add_dll_directory(extra_dll_dir)
"""))
@@ -2495,4 +2491,3 @@ def exec_mod_from_location(modname, modfile):
foo = importlib.util.module_from_spec(spec)
spec.loader.exec_module(foo)
return foo
-
diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py
index 2af0467f1..7b326365d 100644
--- a/numpy/testing/tests/test_utils.py
+++ b/numpy/testing/tests/test_utils.py
@@ -1223,7 +1223,7 @@ class TestStringEqual:
lambda: assert_string_equal("aaa", "a+b"))
-def assert_warn_len_equal(mod, n_in_context, py37=None):
+def assert_warn_len_equal(mod, n_in_context):
try:
mod_warns = mod.__warningregistry__
except AttributeError:
@@ -1245,6 +1245,7 @@ def assert_warn_len_equal(mod, n_in_context, py37=None):
assert_equal(num_warns, n_in_context)
+
def test_warn_len_equal_call_scenarios():
# assert_warn_len_equal is called under
# varying circumstances depending on serial
@@ -1294,22 +1295,20 @@ def test_clear_and_catch_warnings():
warnings.warn('Some warning')
assert_equal(my_mod.__warningregistry__, {})
# Without specified modules, don't clear warnings during context
- # Python 3.7 catch_warnings doesn't make an entry for 'ignore'.
with clear_and_catch_warnings():
warnings.simplefilter('ignore')
warnings.warn('Some warning')
- assert_warn_len_equal(my_mod, 1, py37=0)
+ assert_warn_len_equal(my_mod, 1)
# Confirm that specifying module keeps old warning, does not add new
with clear_and_catch_warnings(modules=[my_mod]):
warnings.simplefilter('ignore')
warnings.warn('Another warning')
- assert_warn_len_equal(my_mod, 1, py37=0)
+ assert_warn_len_equal(my_mod, 1)
# Another warning, no module spec does add to warnings dict, except on
- # Python 3.7 catch_warnings doesn't make an entry for 'ignore'.
with clear_and_catch_warnings():
warnings.simplefilter('ignore')
warnings.warn('Another warning')
- assert_warn_len_equal(my_mod, 2, py37=0)
+ assert_warn_len_equal(my_mod, 2)
def test_suppress_warnings_module():
@@ -1338,7 +1337,7 @@ def test_suppress_warnings_module():
# got filtered)
assert_equal(len(sup.log), 1)
assert_equal(sup.log[0].message.args[0], "Some warning")
- assert_warn_len_equal(my_mod, 0, py37=0)
+ assert_warn_len_equal(my_mod, 0)
sup = suppress_warnings()
# Will have to be changed if apply_along_axis is moved:
sup.filter(module=my_mod)
@@ -1352,11 +1351,11 @@ def test_suppress_warnings_module():
assert_warn_len_equal(my_mod, 0)
# Without specified modules, don't clear warnings during context
- # Python 3.7 does not add ignored warnings.
with suppress_warnings():
warnings.simplefilter('ignore')
warnings.warn('Some warning')
- assert_warn_len_equal(my_mod, 1, py37=0)
+ assert_warn_len_equal(my_mod, 1)
+
def test_suppress_warnings_type():
# Initial state of module, no warnings
@@ -1380,11 +1379,10 @@ def test_suppress_warnings_type():
assert_warn_len_equal(my_mod, 0)
# Without specified modules, don't clear warnings during context
- # Python 3.7 does not add ignored warnings.
with suppress_warnings():
warnings.simplefilter('ignore')
warnings.warn('Some warning')
- assert_warn_len_equal(my_mod, 1, py37=0)
+ assert_warn_len_equal(my_mod, 1)
def test_suppress_warnings_decorate_no_record():
diff --git a/numpy/tests/test_scripts.py b/numpy/tests/test_scripts.py
index e67a82947..5aa8191bb 100644
--- a/numpy/tests/test_scripts.py
+++ b/numpy/tests/test_scripts.py
@@ -24,8 +24,8 @@ def find_f2py_commands():
else:
# Three scripts are installed in Unix-like systems:
# 'f2py', 'f2py{major}', and 'f2py{major.minor}'. For example,
- # if installed with python3.7 the scripts would be named
- # 'f2py', 'f2py3', and 'f2py3.7'.
+ # if installed with python3.9 the scripts would be named
+ # 'f2py', 'f2py3', and 'f2py3.9'.
version = sys.version_info
major = str(version.major)
minor = str(version.minor)
diff --git a/numpy/typing/tests/data/pass/array_constructors.py b/numpy/typing/tests/data/pass/array_constructors.py
index 2763d9c92..e035a73c6 100644
--- a/numpy/typing/tests/data/pass/array_constructors.py
+++ b/numpy/typing/tests/data/pass/array_constructors.py
@@ -23,9 +23,8 @@ B = A.view(SubClass).copy()
B_stack = np.array([[1], [1]]).view(SubClass)
C = [1]
-if sys.version_info >= (3, 8):
- np.ndarray(Index())
- np.ndarray([Index()])
+np.ndarray(Index())
+np.ndarray([Index()])
np.array(1, dtype=float)
np.array(1, copy=False)
diff --git a/numpy/typing/tests/data/pass/scalars.py b/numpy/typing/tests/data/pass/scalars.py
index b258db49f..684d41fad 100644
--- a/numpy/typing/tests/data/pass/scalars.py
+++ b/numpy/typing/tests/data/pass/scalars.py
@@ -59,10 +59,9 @@ np.float64(None)
np.float32("1")
np.float16(b"2.5")
-if sys.version_info >= (3, 8):
- np.uint64(D())
- np.float32(D())
- np.complex64(D())
+np.uint64(D())
+np.float32(D())
+np.complex64(D())
np.bytes_(b"hello")
np.bytes_("hello", 'utf-8')
diff --git a/tools/find_deprecated_escaped_characters.py b/tools/find_deprecated_escaped_characters.py
index 0a324b482..d7225b8e8 100644
--- a/tools/find_deprecated_escaped_characters.py
+++ b/tools/find_deprecated_escaped_characters.py
@@ -7,7 +7,7 @@ were accepted before. For instance, '\(' was previously accepted but must now
be written as '\\(' or r'\('.
"""
-import sys
+
def main(root):
"""Find deprecated escape sequences.
diff --git a/tox.ini b/tox.ini
index ddab07285..f47551398 100644
--- a/tox.ini
+++ b/tox.ini
@@ -13,7 +13,7 @@
# - Use pip to install the numpy sdist into the virtualenv
# - Run the numpy tests
# To run against a specific subset of Python versions, use:
-# tox -e py37
+# tox -e py39
# Extra arguments will be passed to runtests.py. To run
# the full testsuite:
@@ -26,7 +26,7 @@
[tox]
envlist =
- py37,py38,py39
+ py38,py39
[testenv]
deps= -Ur{toxinidir}/test_requirements.txt