diff options
author | Brigitta Sipőcz <bsipocz@gmail.com> | 2022-05-20 18:32:55 -0700 |
---|---|---|
committer | Brigitta Sipőcz <bsipocz@gmail.com> | 2022-05-23 09:29:59 -0700 |
commit | 53379cd353fb7ab5840c3ee370c735fe61d6419c (patch) | |
tree | d3ef9af34179126f996ee3d66d347d0071ddbdd7 | |
parent | eece996beacc8d78bb48749fe515986ede95bf9e (diff) | |
download | numpy-53379cd353fb7ab5840c3ee370c735fe61d6419c.tar.gz |
MAINT: Python <3.7 related cleanups
-rw-r--r-- | INSTALL.rst.txt | 2 | ||||
-rw-r--r-- | doc/HOWTO_RELEASE.rst.txt | 2 | ||||
-rw-r--r-- | doc/source/user/basics.rec.rst | 10 | ||||
-rw-r--r-- | numpy/core/tests/test_deprecations.py | 3 | ||||
-rw-r--r-- | numpy/core/tests/test_multiarray.py | 14 | ||||
-rw-r--r-- | numpy/core/tests/test_regression.py | 6 | ||||
-rw-r--r-- | numpy/distutils/misc_util.py | 3 | ||||
-rw-r--r-- | numpy/f2py/__init__.py | 31 | ||||
-rw-r--r-- | numpy/lib/tests/test_financial_expired.py | 2 | ||||
-rw-r--r-- | numpy/testing/tests/test_utils.py | 7 | ||||
-rwxr-xr-x | tools/changelog.py | 3 | ||||
-rw-r--r-- | tools/find_deprecated_escaped_characters.py | 3 |
12 files changed, 23 insertions, 63 deletions
diff --git a/INSTALL.rst.txt b/INSTALL.rst.txt index 716c5df5b..dabc28899 100644 --- a/INSTALL.rst.txt +++ b/INSTALL.rst.txt @@ -14,7 +14,7 @@ Prerequisites Building NumPy requires the following installed software: -1) Python__ 3.7.x or newer. +1) Python__ 3.8.x or newer. Please note that the Python development headers also need to be installed, e.g., on Debian/Ubuntu one needs to install both `python3` and diff --git a/doc/HOWTO_RELEASE.rst.txt b/doc/HOWTO_RELEASE.rst.txt index 37e047f9f..6bf1b2268 100644 --- a/doc/HOWTO_RELEASE.rst.txt +++ b/doc/HOWTO_RELEASE.rst.txt @@ -153,7 +153,7 @@ What is released Wheels ------ -We currently support Python 3.6-3.8 on Windows, OSX, and Linux +We currently support Python 3.8-3.10 on Windows, OSX, and Linux * Windows: 32-bit and 64-bit wheels built using Appveyor; * OSX: x64_86 OSX wheels built using travis-ci; diff --git a/doc/source/user/basics.rec.rst b/doc/source/user/basics.rec.rst index 98589b472..b3c7f9e4a 100644 --- a/doc/source/user/basics.rec.rst +++ b/doc/source/user/basics.rec.rst @@ -146,16 +146,14 @@ summary they are: 4. A dictionary of field names - The use of this form of specification is discouraged, but documented here - because older numpy code may use it. The keys of the dictionary are the - field names and the values are tuples specifying type and offset:: + The keys of the dictionary are the field names and the values are tuples + specifying type and offset:: >>> np.dtype({'col1': ('i1', 0), 'col2': ('f4', 1)}) dtype([('col1', 'i1'), ('col2', '<f4')]) - This form is discouraged because Python dictionaries do not preserve order - in Python versions before Python 3.6, and the order of the fields in a - structured dtype has meaning. :ref:`Field Titles <titles>` may be + This form was discouraged because Python dictionaries did not preserve order + in Python versions before Python 3.6. :ref:`Field Titles <titles>` may be specified by using a 3-tuple, see below. Manipulating and Displaying Structured Datatypes diff --git a/numpy/core/tests/test_deprecations.py b/numpy/core/tests/test_deprecations.py index 5ab72bdaf..09bd5f553 100644 --- a/numpy/core/tests/test_deprecations.py +++ b/numpy/core/tests/test_deprecations.py @@ -613,9 +613,6 @@ class TestNonExactMatchDeprecation(_DeprecationTestCase): class TestDeprecatedGlobals(_DeprecationTestCase): # 2020-06-06 - @pytest.mark.skipif( - sys.version_info < (3, 7), - reason='module-level __getattr__ not supported') def test_type_aliases(self): # from builtins self.assert_deprecated(lambda: np.bool(True)) diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index cf071a640..ac46b55e6 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -4135,13 +4135,6 @@ class TestPickling: def test_correct_protocol5_error_message(self): array = np.arange(10) - if sys.version_info[:2] in ((3, 6), (3, 7)): - # For the specific case of python3.6 and 3.7, raise a clear import - # error about the pickle5 backport when trying to use protocol=5 - # without the pickle5 package - with pytest.raises(ImportError): - array.__reduce_ex__(5) - def test_record_array_with_object_dtype(self): my_object = object() @@ -8569,10 +8562,9 @@ class TestConversion: self_containing = np.array([None]) self_containing[0] = self_containing - try: - Error = RecursionError - except NameError: - Error = RuntimeError # python < 3.5 + + Error = RecursionError + assert_raises(Error, bool, self_containing) # previously stack overflow self_containing[0] = None # resolve circular reference diff --git a/numpy/core/tests/test_regression.py b/numpy/core/tests/test_regression.py index e578491b3..937dcb93e 100644 --- a/numpy/core/tests/test_regression.py +++ b/numpy/core/tests/test_regression.py @@ -17,12 +17,6 @@ from numpy.testing import ( from numpy.testing._private.utils import _no_tracing, requires_memory from numpy.compat import asbytes, asunicode, pickle -try: - RecursionError -except NameError: - RecursionError = RuntimeError # python < 3.5 - - class TestRegression: def test_invalid_round(self): diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py index 0bee5a8ec..42bf807d1 100644 --- a/numpy/distutils/misc_util.py +++ b/numpy/distutils/misc_util.py @@ -694,8 +694,7 @@ def get_shared_lib_extension(is_python_ext=False): ----- For Python shared libs, `so_ext` will typically be '.so' on Linux and OS X, and '.pyd' on Windows. For Python >= 3.2 `so_ext` has a tag prepended on - POSIX systems according to PEP 3149. For Python 3.2 this is implemented on - Linux, but not on OS X. + POSIX systems according to PEP 3149. """ confvars = distutils.sysconfig.get_config_vars() diff --git a/numpy/f2py/__init__.py b/numpy/f2py/__init__.py index eb8a050a4..84192f738 100644 --- a/numpy/f2py/__init__.py +++ b/numpy/f2py/__init__.py @@ -169,24 +169,19 @@ def get_include(): return os.path.join(os.path.dirname(__file__), 'src') -if sys.version_info[:2] >= (3, 7): - # module level getattr is only supported in 3.7 onwards - # https://www.python.org/dev/peps/pep-0562/ - def __getattr__(attr): - - # Avoid importing things that aren't needed for building - # which might import the main numpy module - if attr == "test": - from numpy._pytesttester import PytestTester - test = PytestTester(__name__) - return test +def __getattr__(attr): - else: - raise AttributeError("module {!r} has no attribute " - "{!r}".format(__name__, attr)) + # Avoid importing things that aren't needed for building + # which might import the main numpy module + if attr == "test": + from numpy._pytesttester import PytestTester + test = PytestTester(__name__) + return test + + else: + raise AttributeError("module {!r} has no attribute " + "{!r}".format(__name__, attr)) - def __dir__(): - return list(globals().keys() | {"test"}) -else: - raise NotImplementedError("F2PY needs Python 3.7") +def __dir__(): + return list(globals().keys() | {"test"}) diff --git a/numpy/lib/tests/test_financial_expired.py b/numpy/lib/tests/test_financial_expired.py index 70b0cd790..838f999a6 100644 --- a/numpy/lib/tests/test_financial_expired.py +++ b/numpy/lib/tests/test_financial_expired.py @@ -3,8 +3,6 @@ import pytest import numpy as np -@pytest.mark.skipif(sys.version_info[:2] < (3, 7), - reason="requires python 3.7 or higher") def test_financial_expired(): match = 'NEP 32' with pytest.warns(DeprecationWarning, match=match): diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py index 4026a7a14..2af0467f1 100644 --- a/numpy/testing/tests/test_utils.py +++ b/numpy/testing/tests/test_utils.py @@ -1243,13 +1243,6 @@ def assert_warn_len_equal(mod, n_in_context, py37=None): # do not count it. num_warns -= 1 - # Behavior of warnings is Python version dependent. Adjust the - # expected result to compensate. In particular, Python 3.7 does - # not make an entry for ignored warnings. - if sys.version_info[:2] >= (3, 7): - if py37 is not None: - n_in_context = py37 - assert_equal(num_warns, n_in_context) def test_warn_len_equal_call_scenarios(): diff --git a/tools/changelog.py b/tools/changelog.py index 444d96882..7b7e66ddb 100755 --- a/tools/changelog.py +++ b/tools/changelog.py @@ -39,9 +39,6 @@ import re from git import Repo from github import Github -if sys.version_info[:2] < (3, 6): - raise RuntimeError("Python version must be >= 3.6") - this_repo = Repo(os.path.join(os.path.dirname(__file__), "..")) author_msg =\ diff --git a/tools/find_deprecated_escaped_characters.py b/tools/find_deprecated_escaped_characters.py index 22efaae65..0a324b482 100644 --- a/tools/find_deprecated_escaped_characters.py +++ b/tools/find_deprecated_escaped_characters.py @@ -56,9 +56,6 @@ def main(root): if __name__ == "__main__": from argparse import ArgumentParser - if sys.version_info[:2] < (3, 6): - raise RuntimeError("Python version must be >= 3.6") - parser = ArgumentParser(description="Find deprecated escaped characters") parser.add_argument('root', help='directory or file to be checked') args = parser.parse_args() |