Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f45c071

Browse files
committed
Merge branch 'main' into manylinux2_28
2 parents 8ac7e08 + dd3e7d9 commit f45c071

7 files changed

Lines changed: 55 additions & 33 deletions

File tree

.github/workflows/linux.yml

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -78,25 +78,24 @@ jobs:
7878
pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple cython
7979
- uses: ./.github/meson_actions
8080

81-
# TODO pypy: uncomment when pypy3.11 becomes available
82-
#pypy:
83-
#needs: [smoke_test]
84-
#runs-on: ubuntu-latest
85-
#if: github.event_name != 'push'
86-
#steps:
87-
#- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
88-
#with:
89-
#submodules: recursive
90-
#fetch-tags: true
91-
#persist-credentials: false
92-
#- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
93-
#with:
94-
#python-version: 'pypy3.10-v7.3.17'
95-
#- name: Setup using scipy-openblas
96-
#run: |
97-
#python -m pip install -r requirements/ci_requirements.txt
98-
#spin config-openblas --with-scipy-openblas=32
99-
#- uses: ./.github/meson_actions
81+
pypy:
82+
needs: [smoke_test]
83+
runs-on: ubuntu-latest
84+
if: github.event_name != 'push'
85+
steps:
86+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
87+
with:
88+
submodules: recursive
89+
fetch-tags: true
90+
persist-credentials: false
91+
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
92+
with:
93+
python-version: 'pypy3.11-v7.3.19'
94+
- name: Setup using scipy-openblas
95+
run: |
96+
python -m pip install -r requirements/ci_requirements.txt
97+
spin config-openblas --with-scipy-openblas=32
98+
- uses: ./.github/meson_actions
10099

101100
debug:
102101
needs: [smoke_test]

.github/workflows/wheels.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,16 @@ jobs:
9191
- [macos-14, macosx_arm64, accelerate] # always use accelerate
9292
- [windows-2019, win_amd64, ""]
9393
- [windows-2019, win32, ""]
94-
# TODO pypy: Add pp311 to this list when it comes out (pp310 removed)
95-
python: ["cp311", "cp312", "cp313", "cp313t"]
94+
python: ["cp311", "cp312", "cp313", "cp313t", "pp311"]
9695
exclude:
9796
# Don't build PyPy 32-bit windows
9897
- buildplat: [windows-2019, win32, ""]
99-
python: "pp310"
98+
python: "pp311"
99+
# No PyPy on musllinux images
100100
- buildplat: [ ubuntu-22.04, musllinux_x86_64, "" ]
101-
python: "pp310"
101+
python: "pp311"
102102
- buildplat: [ ubuntu-22.04-arm, musllinux_aarch64, "" ]
103-
python: "pp310"
104-
- buildplat: [ macos-14, macosx_arm64, accelerate ]
105-
python: "pp310"
103+
python: "pp311"
106104
- buildplat: [ macos13, macosx_x86_64, openblas ]
107105
python: "cp313t"
108106

@@ -173,10 +171,8 @@ jobs:
173171
echo "CIBW_BUILD_FRONTEND=pip; args: --no-build-isolation" >> "$GITHUB_ENV"
174172
175173
- name: Build wheels
176-
uses: pypa/cibuildwheel@ee63bf16da6cddfb925f542f2c7b59ad50e93969 # v2.22.0
174+
uses: pypa/cibuildwheel@6cccd09a31908ffd175b012fb8bf4e1dbda3bc6c # v2.23.0
177175
env:
178-
CIBW_PRERELEASE_PYTHONS: True
179-
CIBW_FREE_THREADED_SUPPORT: True
180176
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
181177

182178
- uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0

azure-pipelines.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ stages:
9191
BITS: 64
9292
_USE_BLAS_ILP64: '1'
9393
# TODO pypy: uncomment when pypy3.11 comes out
94-
# PyPy310-64bit-fast:
95-
# PYTHON_VERSION: 'pypy3.10'
94+
# PyPy311-64bit-fast:
95+
# PYTHON_VERSION: 'pypy3.11'
9696
# PYTHON_ARCH: 'x64'
9797
# TEST_MODE: fast
9898
# BITS: 64

numpy/_core/src/multiarray/ctors.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2138,7 +2138,7 @@ PyArray_FromInterface(PyObject *origin)
21382138
PyArray_Descr *dtype = NULL;
21392139
char *data = NULL;
21402140
Py_buffer view;
2141-
int i, n;
2141+
Py_ssize_t i, n;
21422142
npy_intp dims[NPY_MAXDIMS], strides[NPY_MAXDIMS];
21432143
int dataflags = NPY_ARRAY_BEHAVED;
21442144

@@ -2254,6 +2254,12 @@ PyArray_FromInterface(PyObject *origin)
22542254
/* Get dimensions from shape tuple */
22552255
else {
22562256
n = PyTuple_GET_SIZE(attr);
2257+
if (n > NPY_MAXDIMS) {
2258+
PyErr_Format(PyExc_ValueError,
2259+
"number of dimensions must be within [0, %d], got %d",
2260+
NPY_MAXDIMS, n);
2261+
goto fail;
2262+
}
22572263
for (i = 0; i < n; i++) {
22582264
PyObject *tmp = PyTuple_GET_ITEM(attr, i);
22592265
dims[i] = PyArray_PyIntAsIntp(tmp);

numpy/_core/tests/test_multiarray.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10420,3 +10420,24 @@ def test_to_device(self):
1042010420
r"The stream argument in to_device\(\) is not supported"
1042110421
):
1042210422
arr.to_device("cpu", stream=1)
10423+
10424+
def test_array_interface_excess_dimensions_raises():
10425+
"""Regression test for gh-27949: ensure too many dims raises ValueError instead of segfault."""
10426+
10427+
# Dummy object to hold a custom __array_interface__
10428+
class DummyArray:
10429+
def __init__(self, interface):
10430+
# Attach the array interface dict to mimic an array
10431+
self.__array_interface__ = interface
10432+
10433+
# Create a base array (scalar) and copy its interface
10434+
base = np.array(42) # base can be any scalar or array
10435+
interface = dict(base.__array_interface__)
10436+
10437+
# Modify the shape to exceed NumPy's dimension limit (NPY_MAXDIMS, typically 64)
10438+
interface['shape'] = tuple([1] * 136) # match the original bug report
10439+
10440+
dummy = DummyArray(interface)
10441+
# Now, using np.asanyarray on this dummy should trigger a ValueError (not segfault)
10442+
with pytest.raises(ValueError, match="dimensions must be within"):
10443+
np.asanyarray(dummy)

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ before-build = "bash {project}/tools/wheels/cibw_before_build.sh {project}"
148148
config-settings = "setup-args=-Duse-ilp64=true setup-args=-Dallow-noblas=false build-dir=build"
149149
before-test = "pip install -r {project}/requirements/test_requirements.txt"
150150
test-command = "bash {project}/tools/wheels/cibw_test_command.sh {project}"
151+
enable = ["cpython-freethreading", "pypy", "cpython-prerelease"]
151152

152153
[tool.cibuildwheel.linux]
153154
manylinux-x86_64-image = "manylinux_2_28"

tools/ci/cirrus_wheels.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ macosx_arm64_task:
2020
CIBW_BUILD: cp313-*
2121
- env:
2222
CIBW_BUILD: cp313t-*
23-
CIBW_FREE_THREADED_SUPPORT: 1
2423
CIBW_BUILD_FRONTEND: "pip; args: --no-build-isolation"
2524
env:
2625
PATH: /usr/local/lib:/usr/local/include:$PATH

0 commit comments

Comments
 (0)