Skip to content

Commit 53379cd

Browse files
committed
MAINT: Python <3.7 related cleanups
1 parent eece996 commit 53379cd

File tree

12 files changed

+23
-63
lines changed

12 files changed

+23
-63
lines changed

INSTALL.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Prerequisites
1414

1515
Building NumPy requires the following installed software:
1616

17-
1) Python__ 3.7.x or newer.
17+
1) Python__ 3.8.x or newer.
1818

1919
Please note that the Python development headers also need to be installed,
2020
e.g., on Debian/Ubuntu one needs to install both `python3` and

doc/HOWTO_RELEASE.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ What is released
153153

154154
Wheels
155155
------
156-
We currently support Python 3.6-3.8 on Windows, OSX, and Linux
156+
We currently support Python 3.8-3.10 on Windows, OSX, and Linux
157157

158158
* Windows: 32-bit and 64-bit wheels built using Appveyor;
159159
* OSX: x64_86 OSX wheels built using travis-ci;

doc/source/user/basics.rec.rst

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,14 @@ summary they are:
146146

147147
4. A dictionary of field names
148148

149-
The use of this form of specification is discouraged, but documented here
150-
because older numpy code may use it. The keys of the dictionary are the
151-
field names and the values are tuples specifying type and offset::
149+
The keys of the dictionary are the field names and the values are tuples
150+
specifying type and offset::
152151

153152
>>> np.dtype({'col1': ('i1', 0), 'col2': ('f4', 1)})
154153
dtype([('col1', 'i1'), ('col2', '<f4')])
155154

156-
This form is discouraged because Python dictionaries do not preserve order
157-
in Python versions before Python 3.6, and the order of the fields in a
158-
structured dtype has meaning. :ref:`Field Titles <titles>` may be
155+
This form was discouraged because Python dictionaries did not preserve order
156+
in Python versions before Python 3.6. :ref:`Field Titles <titles>` may be
159157
specified by using a 3-tuple, see below.
160158

161159
Manipulating and Displaying Structured Datatypes

numpy/core/tests/test_deprecations.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -613,9 +613,6 @@ def test_non_exact_match(self):
613613

614614
class TestDeprecatedGlobals(_DeprecationTestCase):
615615
# 2020-06-06
616-
@pytest.mark.skipif(
617-
sys.version_info < (3, 7),
618-
reason='module-level __getattr__ not supported')
619616
def test_type_aliases(self):
620617
# from builtins
621618
self.assert_deprecated(lambda: np.bool(True))

numpy/core/tests/test_multiarray.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4135,13 +4135,6 @@ class TestPickling:
41354135
def test_correct_protocol5_error_message(self):
41364136
array = np.arange(10)
41374137

4138-
if sys.version_info[:2] in ((3, 6), (3, 7)):
4139-
# For the specific case of python3.6 and 3.7, raise a clear import
4140-
# error about the pickle5 backport when trying to use protocol=5
4141-
# without the pickle5 package
4142-
with pytest.raises(ImportError):
4143-
array.__reduce_ex__(5)
4144-
41454138
def test_record_array_with_object_dtype(self):
41464139
my_object = object()
41474140

@@ -8569,10 +8562,9 @@ def __bool__(self):
85698562

85708563
self_containing = np.array([None])
85718564
self_containing[0] = self_containing
8572-
try:
8573-
Error = RecursionError
8574-
except NameError:
8575-
Error = RuntimeError # python < 3.5
8565+
8566+
Error = RecursionError
8567+
85768568
assert_raises(Error, bool, self_containing) # previously stack overflow
85778569
self_containing[0] = None # resolve circular reference
85788570

numpy/core/tests/test_regression.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@
1717
from numpy.testing._private.utils import _no_tracing, requires_memory
1818
from numpy.compat import asbytes, asunicode, pickle
1919

20-
try:
21-
RecursionError
22-
except NameError:
23-
RecursionError = RuntimeError # python < 3.5
24-
25-
2620

2721
class TestRegression:
2822
def test_invalid_round(self):

numpy/distutils/misc_util.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,8 +694,7 @@ def get_shared_lib_extension(is_python_ext=False):
694694
-----
695695
For Python shared libs, `so_ext` will typically be '.so' on Linux and OS X,
696696
and '.pyd' on Windows. For Python >= 3.2 `so_ext` has a tag prepended on
697-
POSIX systems according to PEP 3149. For Python 3.2 this is implemented on
698-
Linux, but not on OS X.
697+
POSIX systems according to PEP 3149.
699698
700699
"""
701700
confvars = distutils.sysconfig.get_config_vars()

numpy/f2py/__init__.py

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -169,24 +169,19 @@ def get_include():
169169
return os.path.join(os.path.dirname(__file__), 'src')
170170

171171

172-
if sys.version_info[:2] >= (3, 7):
173-
# module level getattr is only supported in 3.7 onwards
174-
# https://www.python.org/dev/peps/pep-0562/
175-
def __getattr__(attr):
176-
177-
# Avoid importing things that aren't needed for building
178-
# which might import the main numpy module
179-
if attr == "test":
180-
from numpy._pytesttester import PytestTester
181-
test = PytestTester(__name__)
182-
return test
172+
def __getattr__(attr):
183173

184-
else:
185-
raise AttributeError("module {!r} has no attribute "
186-
"{!r}".format(__name__, attr))
174+
# Avoid importing things that aren't needed for building
175+
# which might import the main numpy module
176+
if attr == "test":
177+
from numpy._pytesttester import PytestTester
178+
test = PytestTester(__name__)
179+
return test
180+
181+
else:
182+
raise AttributeError("module {!r} has no attribute "
183+
"{!r}".format(__name__, attr))
187184

188-
def __dir__():
189-
return list(globals().keys() | {"test"})
190185

191-
else:
192-
raise NotImplementedError("F2PY needs Python 3.7")
186+
def __dir__():
187+
return list(globals().keys() | {"test"})

numpy/lib/tests/test_financial_expired.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import numpy as np
44

55

6-
@pytest.mark.skipif(sys.version_info[:2] < (3, 7),
7-
reason="requires python 3.7 or higher")
86
def test_financial_expired():
97
match = 'NEP 32'
108
with pytest.warns(DeprecationWarning, match=match):

numpy/testing/tests/test_utils.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,13 +1243,6 @@ def assert_warn_len_equal(mod, n_in_context, py37=None):
12431243
# do not count it.
12441244
num_warns -= 1
12451245

1246-
# Behavior of warnings is Python version dependent. Adjust the
1247-
# expected result to compensate. In particular, Python 3.7 does
1248-
# not make an entry for ignored warnings.
1249-
if sys.version_info[:2] >= (3, 7):
1250-
if py37 is not None:
1251-
n_in_context = py37
1252-
12531246
assert_equal(num_warns, n_in_context)
12541247

12551248
def test_warn_len_equal_call_scenarios():

0 commit comments

Comments
 (0)