Skip to content

Commit d4d5771

Browse files
committed
MAINT: Python <3.8 related cleanups
1 parent 53379cd commit d4d5771

File tree

13 files changed

+26
-65
lines changed

13 files changed

+26
-65
lines changed

azure-pipelines.yml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -299,31 +299,3 @@ stages:
299299
testResultsFiles: '**/test-*.xml'
300300
failTaskOnFailedTests: true
301301
testRunTitle: 'Publish test results for conda installation'
302-
303-
304-
#- job: Linux_gcc48
305-
#pool:
306-
## ubuntu-20.04 does not provide a gcc-4.8 package
307-
#vmImage: 'ubuntu-18.04'
308-
#steps:
309-
#- script: |
310-
#sudo apt update
311-
#sudo apt install python3.7
312-
#sudo apt install python3.7-dev
313-
#if ! `gcc-4.8 2>/dev/null`; then
314-
#sudo apt install gcc-4.8
315-
#fi
316-
#displayName: 'add gcc 4.8'
317-
#- script: |
318-
## python3 has no setuptools, so install one to get us going
319-
#python3.7 -m pip install --user --upgrade pip 'setuptools<49.2.0'
320-
#python3.7 -m pip install --user -r test_requirements.txt
321-
#CPPFLAGS='' CC=gcc-4.8 F77=gfortran-5 F90=gfortran-5 \
322-
#python3.7 runtests.py --debug-info --mode=full -- -rsx --junitxml=junit/test-results.xml
323-
#displayName: 'Run gcc4.8 Build / Tests'
324-
#- task: PublishTestResults@2
325-
#condition: succeededOrFailed()
326-
#inputs:
327-
#testResultsFiles: '**/test-*.xml'
328-
#failTaskOnFailedTests: true
329-
#testRunTitle: 'Publish test results for gcc 4.8'

doc/source/dev/development_environment.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ That also takes extra arguments, like ``--pdb`` which drops you into the Python
194194
debugger when a test fails or an exception is raised.
195195

196196
Running tests with `tox`_ is also supported. For example, to build NumPy and
197-
run the test suite with Python 3.7, use::
197+
run the test suite with Python 3.9, use::
198198

199-
$ tox -e py37
199+
$ tox -e py39
200200

201201
For more extensive information, see :ref:`testing-guidelines`
202202

doc/source/f2py/code/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
1414
)
1515
endif()
1616

17-
# Grab Python, 3.7 or newer
18-
find_package(Python 3.7 REQUIRED
17+
# Grab Python, 3.8 or newer
18+
find_package(Python 3.8 REQUIRED
1919
COMPONENTS Interpreter Development.Module NumPy)
2020

2121
# Grab the variables from a local Python installation

doc/source/f2py/code/CMakeLists_skbuild.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ endif()
1717

1818
# Ensure scikit-build modules
1919
if (NOT SKBUILD)
20-
find_package(PythonInterp 3.7 REQUIRED)
20+
find_package(PythonInterp 3.8 REQUIRED)
2121
# Kanged --> https://github.com/Kitware/torch_liberator/blob/master/CMakeLists.txt
2222
# If skbuild is not the driver; include its utilities in CMAKE_MODULE_PATH
2323
execute_process(

doc/source/user/absolute_beginners.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,7 @@ followed by the docstring of ``ndarray`` of which ``a`` is an instance):
13441344
Type: ndarray
13451345
String form: [1 2 3 4 5 6]
13461346
Length: 6
1347-
File: ~/anaconda3/lib/python3.7/site-packages/numpy/__init__.py
1347+
File: ~/anaconda3/lib/python3.9/site-packages/numpy/__init__.py
13481348
Docstring: <no docstring>
13491349
Class docstring:
13501350
ndarray(shape, dtype=float, buffer=None, offset=0,

numpy/core/tests/test_regression.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2480,8 +2480,6 @@ def __len__(self):
24802480
assert arr.shape == (1, 0, 0)
24812481

24822482
@pytest.mark.skipif(sys.maxsize < 2 ** 31 + 1, reason='overflows 32-bit python')
2483-
@pytest.mark.skipif(sys.platform == 'win32' and sys.version_info[:2] < (3, 8),
2484-
reason='overflows on windows, fixed in bpo-16865')
24852483
def test_to_ctypes(self):
24862484
#gh-14214
24872485
arr = np.zeros((2 ** 31 + 1,), 'b')

numpy/distutils/misc_util.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2348,11 +2348,7 @@ def generate_config_py(target):
23482348
extra_dll_dir = os.path.join(os.path.dirname(__file__), '.libs')
23492349
23502350
if sys.platform == 'win32' and os.path.isdir(extra_dll_dir):
2351-
if sys.version_info >= (3, 8):
2352-
os.add_dll_directory(extra_dll_dir)
2353-
else:
2354-
os.environ.setdefault('PATH', '')
2355-
os.environ['PATH'] += os.pathsep + extra_dll_dir
2351+
os.add_dll_directory(extra_dll_dir)
23562352
23572353
"""))
23582354

@@ -2495,4 +2491,3 @@ def exec_mod_from_location(modname, modfile):
24952491
foo = importlib.util.module_from_spec(spec)
24962492
spec.loader.exec_module(foo)
24972493
return foo
2498-

numpy/testing/tests/test_utils.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,7 +1223,7 @@ def test_regex(self):
12231223
lambda: assert_string_equal("aaa", "a+b"))
12241224

12251225

1226-
def assert_warn_len_equal(mod, n_in_context, py37=None):
1226+
def assert_warn_len_equal(mod, n_in_context):
12271227
try:
12281228
mod_warns = mod.__warningregistry__
12291229
except AttributeError:
@@ -1245,6 +1245,7 @@ def assert_warn_len_equal(mod, n_in_context, py37=None):
12451245

12461246
assert_equal(num_warns, n_in_context)
12471247

1248+
12481249
def test_warn_len_equal_call_scenarios():
12491250
# assert_warn_len_equal is called under
12501251
# varying circumstances depending on serial
@@ -1294,22 +1295,20 @@ def test_clear_and_catch_warnings():
12941295
warnings.warn('Some warning')
12951296
assert_equal(my_mod.__warningregistry__, {})
12961297
# Without specified modules, don't clear warnings during context
1297-
# Python 3.7 catch_warnings doesn't make an entry for 'ignore'.
12981298
with clear_and_catch_warnings():
12991299
warnings.simplefilter('ignore')
13001300
warnings.warn('Some warning')
1301-
assert_warn_len_equal(my_mod, 1, py37=0)
1301+
assert_warn_len_equal(my_mod, 1)
13021302
# Confirm that specifying module keeps old warning, does not add new
13031303
with clear_and_catch_warnings(modules=[my_mod]):
13041304
warnings.simplefilter('ignore')
13051305
warnings.warn('Another warning')
1306-
assert_warn_len_equal(my_mod, 1, py37=0)
1306+
assert_warn_len_equal(my_mod, 1)
13071307
# Another warning, no module spec does add to warnings dict, except on
1308-
# Python 3.7 catch_warnings doesn't make an entry for 'ignore'.
13091308
with clear_and_catch_warnings():
13101309
warnings.simplefilter('ignore')
13111310
warnings.warn('Another warning')
1312-
assert_warn_len_equal(my_mod, 2, py37=0)
1311+
assert_warn_len_equal(my_mod, 2)
13131312

13141313

13151314
def test_suppress_warnings_module():
@@ -1338,7 +1337,7 @@ def warn(arr):
13381337
# got filtered)
13391338
assert_equal(len(sup.log), 1)
13401339
assert_equal(sup.log[0].message.args[0], "Some warning")
1341-
assert_warn_len_equal(my_mod, 0, py37=0)
1340+
assert_warn_len_equal(my_mod, 0)
13421341
sup = suppress_warnings()
13431342
# Will have to be changed if apply_along_axis is moved:
13441343
sup.filter(module=my_mod)
@@ -1352,11 +1351,11 @@ def warn(arr):
13521351
assert_warn_len_equal(my_mod, 0)
13531352

13541353
# Without specified modules, don't clear warnings during context
1355-
# Python 3.7 does not add ignored warnings.
13561354
with suppress_warnings():
13571355
warnings.simplefilter('ignore')
13581356
warnings.warn('Some warning')
1359-
assert_warn_len_equal(my_mod, 1, py37=0)
1357+
assert_warn_len_equal(my_mod, 1)
1358+
13601359

13611360
def test_suppress_warnings_type():
13621361
# Initial state of module, no warnings
@@ -1380,11 +1379,10 @@ def test_suppress_warnings_type():
13801379
assert_warn_len_equal(my_mod, 0)
13811380

13821381
# Without specified modules, don't clear warnings during context
1383-
# Python 3.7 does not add ignored warnings.
13841382
with suppress_warnings():
13851383
warnings.simplefilter('ignore')
13861384
warnings.warn('Some warning')
1387-
assert_warn_len_equal(my_mod, 1, py37=0)
1385+
assert_warn_len_equal(my_mod, 1)
13881386

13891387

13901388
def test_suppress_warnings_decorate_no_record():

numpy/tests/test_scripts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ def find_f2py_commands():
2424
else:
2525
# Three scripts are installed in Unix-like systems:
2626
# 'f2py', 'f2py{major}', and 'f2py{major.minor}'. For example,
27-
# if installed with python3.7 the scripts would be named
28-
# 'f2py', 'f2py3', and 'f2py3.7'.
27+
# if installed with python3.9 the scripts would be named
28+
# 'f2py', 'f2py3', and 'f2py3.9'.
2929
version = sys.version_info
3030
major = str(version.major)
3131
minor = str(version.minor)

numpy/typing/tests/data/pass/array_constructors.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ def func(i: int, j: int, **kwargs: Any) -> SubClass:
2323
B_stack = np.array([[1], [1]]).view(SubClass)
2424
C = [1]
2525

26-
if sys.version_info >= (3, 8):
27-
np.ndarray(Index())
28-
np.ndarray([Index()])
26+
np.ndarray(Index())
27+
np.ndarray([Index()])
2928

3029
np.array(1, dtype=float)
3130
np.array(1, copy=False)

0 commit comments

Comments
 (0)