GeezerVison is showing github.com — Merge pull request #23991 from rgommers/py312-wheels · numpy/numpy@dbc454a
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .github/workflows/wheels.yml +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 78 | 78 | - [ubuntu-20.04, musllinux_x86_64] | 79 | 79 | - [macos-12, macosx_x86_64] | 80 | 80 | - [windows-2019, win_amd64] | 81 | | - python: ["cp39", "cp310", "cp311"] | 82 | | - # python: ["cp39", "cp310", "cp311", "pp39"] | | 81 | + python: ["cp39", "cp310", "cp311", "cp312"] # "pp39" | 83 | 82 | exclude: | 84 | 83 | # Don't build PyPy 32-bit windows | 85 | 84 | - buildplat: [windows-2019, win32] | @@ -114,6 +113,7 @@ jobs: | 114 | 113 | - name: Build wheels | 115 | 114 | uses: pypa/cibuildwheel@0ecddd92b62987d7a2ae8911f4bb8ec9e2e4496a # v2.13.1 | 116 | 115 | env: | | 116 | + CIBW_PRERELEASE_PYTHONS: True | 117 | 117 | CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} | 118 | 118 |
| 119 | 119 | - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
Collapse file Copy file name to clipboardExpand all lines: numpy/__init__.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 66 | 66 | NumPy testing tools | 67 | 67 | distutils | 68 | 68 | Enhancements to distutils with support for | 69 | | - Fortran compilers support and more. | | 69 | + Fortran compilers support and more (for Python <= 3.11) | 70 | 70 |
| 71 | 71 | Utilities | 72 | 72 | --------- | |
Collapse file Copy file name to clipboardExpand all lines: numpy/_pytesttester.py +7-6Lines changed: 7 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -135,12 +135,13 @@ def __call__(self, label='fast', verbose=1, extra_argv=None, | 135 | 135 | # offset verbosity. The "-q" cancels a "-v". | 136 | 136 | pytest_args += ["-q"] | 137 | 137 |
| 138 | | - with warnings.catch_warnings(): | 139 | | - warnings.simplefilter("always") | 140 | | - # Filter out distutils cpu warnings (could be localized to | 141 | | - # distutils tests). ASV has problems with top level import, | 142 | | - # so fetch module for suppression here. | 143 | | - from numpy.distutils import cpuinfo | | 138 | + if sys.version_info < (3, 12): | | 139 | + with warnings.catch_warnings(): | | 140 | + warnings.simplefilter("always") | | 141 | + # Filter out distutils cpu warnings (could be localized to | | 142 | + # distutils tests). ASV has problems with top level import, | | 143 | + # so fetch module for suppression here. | | 144 | + from numpy.distutils import cpuinfo | 144 | 145 |
| 145 | 146 | with warnings.catch_warnings(record=True): | 146 | 147 | # Ignore the warning from importing the array_api submodule. This | |
Collapse file Copy file name to clipboardExpand all lines: numpy/core/tests/test_array_interface.py +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -128,6 +128,9 @@ def get_module(tmp_path): | 128 | 128 | more_init=more_init) | 129 | 129 |
| 130 | 130 |
| | 131 | +# FIXME: numpy.testing.extbuild uses `numpy.distutils`, so this won't work on | | 132 | +# Python 3.12 and up. | | 133 | +@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") | 131 | 134 | @pytest.mark.slow | 132 | 135 | def test_cstruct(get_module): | 133 | 136 |
| |
Collapse file Copy file name to clipboardExpand all lines: numpy/core/tests/test_dtype.py +5Lines changed: 5 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -755,6 +755,11 @@ def iter_struct_object_dtypes(): | 755 | 755 | yield pytest.param(dt, p, 12, obj, id="<structured subarray 2>") | 756 | 756 |
| 757 | 757 |
| | 758 | +@pytest.mark.skipif( | | 759 | + sys.version_info >= (3, 12), | | 760 | + reason="Python 3.12 has immortal refcounts, this test will no longer " | | 761 | + "work. See gh-23986" | | 762 | +) | 758 | 763 | @pytest.mark.skipif(not HAS_REFCOUNT, reason="Python lacks refcounts") | 759 | 764 | class TestStructuredObjectRefcounting: | 760 | 765 | """These tests cover various uses of complicated structured types which | |
Collapse file Copy file name to clipboardExpand all lines: numpy/core/tests/test_mem_policy.py +15Lines changed: 15 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 9 | 9 | import sys | 10 | 10 |
| 11 | 11 |
| | 12 | +# FIXME: numpy.testing.extbuild uses `numpy.distutils`, so this won't work on | | 13 | +# Python 3.12 and up. It's an internal test utility, so for now we just skip | | 14 | +# these tests. | | 15 | + | | 16 | + | 12 | 17 | @pytest.fixture | 13 | 18 | def get_module(tmp_path): | 14 | 19 | """ Add a memory policy that returns a false pointer 64 bytes into the | @@ -213,6 +218,7 @@ def get_module(tmp_path): | 213 | 218 | more_init=more_init) | 214 | 219 |
| 215 | 220 |
| | 221 | +@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") | 216 | 222 | def test_set_policy(get_module): | 217 | 223 |
| 218 | 224 | get_handler_name = np.core.multiarray.get_handler_name | @@ -241,6 +247,7 @@ def test_set_policy(get_module): | 241 | 247 | assert get_handler_name() == orig_policy_name | 242 | 248 |
| 243 | 249 |
| | 250 | +@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") | 244 | 251 | def test_default_policy_singleton(get_module): | 245 | 252 | get_handler_name = np.core.multiarray.get_handler_name | 246 | 253 |
| @@ -262,6 +269,7 @@ def test_default_policy_singleton(get_module): | 262 | 269 | assert def_policy_1 is def_policy_2 is get_module.get_default_policy() | 263 | 270 |
| 264 | 271 |
| | 272 | +@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") | 265 | 273 | def test_policy_propagation(get_module): | 266 | 274 | # The memory policy goes hand-in-hand with flags.owndata | 267 | 275 |
| @@ -320,6 +328,7 @@ async def async_test_context_locality(get_module): | 320 | 328 | assert np.core.multiarray.get_handler_name() == orig_policy_name | 321 | 329 |
| 322 | 330 |
| | 331 | +@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") | 323 | 332 | def test_context_locality(get_module): | 324 | 333 | if (sys.implementation.name == 'pypy' | 325 | 334 | and sys.pypy_version_info[:3] < (7, 3, 6)): | @@ -341,6 +350,7 @@ def concurrent_thread2(get_module, event): | 341 | 350 | get_module.set_secret_data_policy() | 342 | 351 |
| 343 | 352 |
| | 353 | +@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") | 344 | 354 | def test_thread_locality(get_module): | 345 | 355 | orig_policy_name = np.core.multiarray.get_handler_name() | 346 | 356 |
| @@ -359,6 +369,7 @@ def test_thread_locality(get_module): | 359 | 369 | assert np.core.multiarray.get_handler_name() == orig_policy_name | 360 | 370 |
| 361 | 371 |
| | 372 | +@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") | 362 | 373 | @pytest.mark.skip(reason="too slow, see gh-23975") | 363 | 374 | def test_new_policy(get_module): | 364 | 375 | a = np.arange(10) | @@ -388,6 +399,8 @@ def test_new_policy(get_module): | 388 | 399 | c = np.arange(10) | 389 | 400 | assert np.core.multiarray.get_handler_name(c) == orig_policy_name | 390 | 401 |
| | 402 | + | | 403 | +@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") | 391 | 404 | @pytest.mark.xfail(sys.implementation.name == "pypy", | 392 | 405 | reason=("bad interaction between getenv and " | 393 | 406 | "os.environ inside pytest")) | @@ -420,6 +433,8 @@ def test_switch_owner(get_module, policy): | 420 | 433 | else: | 421 | 434 | os.environ['NUMPY_WARN_IF_NO_MEM_POLICY'] = oldval | 422 | 435 |
| | 436 | + | | 437 | +@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") | 423 | 438 | def test_owner_is_base(get_module): | 424 | 439 | a = get_module.get_array_with_base() | 425 | 440 | with pytest.warns(UserWarning, match='warn_on_free'): | |
Collapse file Copy file name to clipboardExpand all lines: numpy/core/tests/test_regression.py +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1465,6 +1465,10 @@ def test_structured_arrays_with_objects1(self): | 1465 | 1465 | x[x.nonzero()] = x.ravel()[:1] | 1466 | 1466 | assert_(x[0, 1] == x[0, 0]) | 1467 | 1467 |
| | 1468 | + @pytest.mark.skipif( | | 1469 | + sys.version_info >= (3, 12), | | 1470 | + reason="Python 3.12 has immortal refcounts, this test no longer works." | | 1471 | + ) | 1468 | 1472 | @pytest.mark.skipif(not HAS_REFCOUNT, reason="Python lacks refcounts") | 1469 | 1473 | def test_structured_arrays_with_objects2(self): | 1470 | 1474 | # Ticket #1299 second test | |
Collapse file Copy file name to clipboardExpand all lines: numpy/lib/tests/test_format.py +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -527,6 +527,7 @@ def test_load_padded_dtype(tmpdir, dt): | 527 | 527 | assert_array_equal(arr, arr1) | 528 | 528 |
| 529 | 529 |
| | 530 | +@pytest.mark.skipif(sys.version_info >= (3, 12), reason="see gh-23988") | 530 | 531 | @pytest.mark.xfail(IS_WASM, reason="Emscripten NODEFS has a buggy dup") | 531 | 532 | def test_python2_python3_interoperability(): | 532 | 533 | fname = 'win64python2.npy' | |
Collapse file Copy file name to clipboardExpand all lines: numpy/meson.build +3-1Lines changed: 3 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -150,7 +150,6 @@ pure_subdirs = [ | 150 | 150 | '_utils', | 151 | 151 | 'array_api', | 152 | 152 | 'compat', | 153 | | - 'distutils', | 154 | 153 | 'doc', | 155 | 154 | 'f2py', | 156 | 155 | 'lib', | @@ -161,6 +160,9 @@ pure_subdirs = [ | 161 | 160 | 'tests', | 162 | 161 | 'typing', | 163 | 162 | ] | | 163 | +if py.version().version_compare('<3.12') | | 164 | + pure_subdirs += 'distutils' | | 165 | +endif | 164 | 166 |
| 165 | 167 | np_dir = py.get_install_dir() / 'numpy' | 166 | 168 |
| |
Collapse file Copy file name to clipboardExpand all lines: numpy/random/tests/test_extending.py +4-1Lines changed: 4 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 4 | 4 | import subprocess | 5 | 5 | import sys | 6 | 6 | import warnings | | 7 | + | 7 | 8 | import numpy as np | 8 | | -from numpy.distutils.misc_util import exec_mod_from_location | 9 | 9 | from numpy.testing import IS_WASM | 10 | 10 |
| 11 | 11 |
| | 45 | 45 | cython = None | 46 | 46 |
| 47 | 47 |
| | 48 | +@pytest.mark.skipif(sys.version_info >= (3, 12), | | 49 | + reason="numpy.distutils not supported anymore") | 48 | 50 | @pytest.mark.skipif(IS_WASM, reason="Can't start subprocess") | 49 | 51 | @pytest.mark.skipif(cython is None, reason="requires cython") | 50 | 52 | @pytest.mark.slow | 51 | 53 | def test_cython(tmp_path): | | 54 | + from numpy.distutils.misc_util import exec_mod_from_location | 52 | 55 | srcdir = os.path.join(os.path.dirname(__file__), '..') | 53 | 56 | shutil.copytree(srcdir, tmp_path / 'random') | 54 | 57 | # build the examples and "install" them into a temporary directory | |
|