Skip to content

Commit

Permalink
Merge pull request #14937 from rgommers/ci-failures-17x
Browse files Browse the repository at this point in the history
MAINT: backports for 1.7.2, plus update Pythran min version to 0.9.12
  • Loading branch information
tylerjereddy committed Oct 29, 2021
2 parents 9639c9f + 0054fae commit 5f587c6
Show file tree
Hide file tree
Showing 35 changed files with 65 additions and 5 deletions.
1 change: 1 addition & 0 deletions .coveragerc
Expand Up @@ -5,3 +5,4 @@ omit =
scipy/setup.py
scipy/*/setup.py
scipy/signal/_max_len_seq_inner.py
disable_warnings = include-ignored
1 change: 1 addition & 0 deletions .github/workflows/macos.yml
Expand Up @@ -81,4 +81,5 @@ jobs:
- name: Test SciPy
run: |
export LIBRARY_PATH="$LIBRARY_PATH:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib"
SCIPY_USE_PYTHRAN=`test ${{ matrix.python-version }} != 3.9; echo $?` python -u runtests.py
2 changes: 1 addition & 1 deletion pyproject.toml
Expand Up @@ -13,7 +13,7 @@ requires = [
"setuptools<58.0.0",
"Cython>=0.29.18,<3.0",
"pybind11>=2.4.3,<2.8.0",
"pythran>=0.9.11,<0.10.0",
"pythran>=0.9.12,<0.10.0",

# NumPy dependencies - to update these, sync from
# https://github.com/scipy/oldest-supported-numpy/, and then
Expand Down
1 change: 1 addition & 0 deletions scipy/cluster/_hierarchy.pyx
Expand Up @@ -11,6 +11,7 @@ cdef extern from "numpy/npy_math.h":

ctypedef unsigned char uchar

np.import_array()

# _hierarchy_distance_update.pxi includes the definition of linkage_distance_update
# and the distance update functions for the supported linkage methods.
Expand Down
1 change: 1 addition & 0 deletions scipy/cluster/_optimal_leaf_ordering.pyx
Expand Up @@ -32,6 +32,7 @@ from libc.stdlib cimport malloc, free

from scipy.spatial.distance import squareform, is_valid_y, is_valid_dm

np.import_array()

@cython.profile(False)
@cython.boundscheck(False)
Expand Down
2 changes: 2 additions & 0 deletions scipy/fftpack/convolve.pyx
Expand Up @@ -3,6 +3,8 @@ import numpy as np
cimport numpy as np
cimport cython

np.import_array()

__all__ = ['destroy_convolve_cache', 'convolve', 'convolve_z',
'init_convolution_kernel']

Expand Down
2 changes: 2 additions & 0 deletions scipy/interpolate/_bspl.pyx
Expand Up @@ -8,6 +8,8 @@ cimport numpy as cnp

cimport cython

cnp.import_array()

cdef extern from "src/__fitpack.h":
void _deBoor_D(const double *t, double x, int k, int ell, int m, double *result) nogil

Expand Down
2 changes: 2 additions & 0 deletions scipy/io/matlab/mio_utils.pyx
Expand Up @@ -5,6 +5,8 @@
import numpy as np
cimport numpy as cnp

cnp.import_array()


cpdef object squeeze_element(cnp.ndarray arr):
''' Return squeezed element
Expand Down
1 change: 1 addition & 0 deletions scipy/ndimage/src/_cytest.pyx
Expand Up @@ -6,6 +6,7 @@ from cpython.pycapsule cimport (
cimport numpy as np
from numpy cimport npy_intp as intp

np.import_array()

cdef void _destructor(obj):
cdef void *callback_data = PyCapsule_GetContext(obj)
Expand Down
2 changes: 2 additions & 0 deletions scipy/optimize/_bglu_dense.pyx
Expand Up @@ -11,6 +11,8 @@ try:
except ImportError:
from time import clock as timer

np.import_array()

__all__ = ['LU', 'BGLU']

@cython.boundscheck(False)
Expand Down
2 changes: 2 additions & 0 deletions scipy/optimize/_group_columns.pyx
Expand Up @@ -10,6 +10,8 @@ import numpy as np
cimport numpy as np
from cpython cimport bool

np.import_array()


@cython.boundscheck(False)
@cython.wraparound(False)
Expand Down
2 changes: 2 additions & 0 deletions scipy/optimize/_highs/cython/src/_highs_wrapper.pyx
Expand Up @@ -64,6 +64,8 @@ from .HighsOptions cimport (
)
from .HighsModelUtils cimport utilPrimalDualStatusToString

np.import_array()

# options to reference for default values and bounds;
# make a map to quickly lookup
cdef HighsOptions _ref_opts
Expand Down
1 change: 1 addition & 0 deletions scipy/optimize/_trlib/_trlib.pyx
Expand Up @@ -6,6 +6,7 @@ cimport numpy as np

from scipy._lib.messagestream cimport MessageStream

np.import_array()

class TRLIBQuadraticSubproblem(BaseQuadraticSubproblem):

Expand Down
1 change: 1 addition & 0 deletions scipy/signal/_max_len_seq_inner.pyx
Expand Up @@ -5,6 +5,7 @@ import numpy as np
cimport numpy as np
cimport cython

np.import_array()

# Fast inner loop of max_len_seq.
@cython.cdivision(True) # faster modulo
Expand Down
1 change: 1 addition & 0 deletions scipy/signal/_peak_finding_utils.pyx
Expand Up @@ -11,6 +11,7 @@ import numpy as np
cimport numpy as np
from libc.math cimport ceil

np.import_array()

__all__ = ['_local_maxima_1d', '_select_by_peak_distance', '_peak_prominences',
'_peak_widths']
Expand Down
2 changes: 2 additions & 0 deletions scipy/signal/_sosfilt.pyx
@@ -1,6 +1,8 @@
cimport numpy as np
cimport cython

np.import_array()

ctypedef fused DTYPE_floating_t:
float
float complex
Expand Down
2 changes: 2 additions & 0 deletions scipy/signal/_spectral.pyx
Expand Up @@ -7,6 +7,8 @@ import numpy as np
cimport numpy as np
cimport cython

np.import_array()

__all__ = ['_lombscargle']


Expand Down
1 change: 1 addition & 0 deletions scipy/signal/_upfirdn_apply.pyx
Expand Up @@ -40,6 +40,7 @@ from cython import bint # boolean integer type
from libc.stdlib cimport malloc, free
from libc.string cimport memset

np.import_array()

ctypedef double complex double_complex
ctypedef float complex float_complex
Expand Down
2 changes: 2 additions & 0 deletions scipy/sparse/csgraph/_flow.pyx
Expand Up @@ -7,6 +7,8 @@ cimport numpy as np

include 'parameters.pxi'

np.import_array()


class MaximumFlowResult:
"""Represents the result of a maximum flow calculation.
Expand Down
2 changes: 2 additions & 0 deletions scipy/sparse/csgraph/_matching.pyx
Expand Up @@ -9,6 +9,8 @@ from numpy.math cimport INFINITY
from scipy.sparse import (csr_matrix,
isspmatrix_coo, isspmatrix_csc, isspmatrix_csr)

np.import_array()

include "parameters.pxi"


Expand Down
2 changes: 2 additions & 0 deletions scipy/sparse/csgraph/_min_spanning_tree.pyx
Expand Up @@ -8,6 +8,8 @@ cimport cython
from scipy.sparse import csr_matrix, isspmatrix_csc, isspmatrix
from scipy.sparse.csgraph._validation import validate_graph

np.import_array()

include 'parameters.pxi'

def minimum_spanning_tree(csgraph, overwrite=False):
Expand Down
1 change: 1 addition & 0 deletions scipy/sparse/csgraph/_reordering.pyx
Expand Up @@ -10,6 +10,7 @@ from scipy.sparse import (csc_matrix, csr_matrix, isspmatrix, isspmatrix_coo,
SparseEfficiencyWarning)
from . import maximum_bipartite_matching

np.import_array()

include 'parameters.pxi'

Expand Down
2 changes: 2 additions & 0 deletions scipy/sparse/csgraph/_shortest_path.pyx
Expand Up @@ -22,6 +22,8 @@ cimport cython
from libc.stdlib cimport malloc, free
from numpy.math cimport INFINITY

np.import_array()

include 'parameters.pxi'


Expand Down
2 changes: 2 additions & 0 deletions scipy/sparse/csgraph/_tools.pyx
Expand Up @@ -11,6 +11,8 @@ cimport numpy as np
from scipy.sparse import csr_matrix, isspmatrix,\
isspmatrix_csr, isspmatrix_csc, isspmatrix_lil

np.import_array()

include 'parameters.pxi'

def csgraph_from_masked(graph):
Expand Down
2 changes: 2 additions & 0 deletions scipy/sparse/csgraph/_traversal.pyx
Expand Up @@ -15,6 +15,8 @@ from scipy.sparse.csgraph._tools import reconstruct_path
cimport cython
from libc cimport stdlib

np.import_array()

include 'parameters.pxi'

def connected_components(csgraph, directed=True, connection='weak',
Expand Down
2 changes: 2 additions & 0 deletions scipy/spatial/_hausdorff.pyx
Expand Up @@ -15,6 +15,8 @@ cimport numpy as np
cimport cython
from libc.math cimport sqrt

np.import_array()

__all__ = ['directed_hausdorff']

@cython.boundscheck(False)
Expand Down
2 changes: 2 additions & 0 deletions scipy/spatial/_voronoi.pyx
Expand Up @@ -14,6 +14,8 @@ import numpy as np
cimport numpy as np
cimport cython

np.import_array()

__all__ = ['sort_vertices_of_regions']

# array-filling placeholder that can never occur
Expand Down
2 changes: 2 additions & 0 deletions scipy/spatial/ckdtree.pyx
Expand Up @@ -23,6 +23,8 @@ import threading
import operator
import warnings

np.import_array()

cdef extern from "<limits.h>":
long LONG_MAX

Expand Down
2 changes: 2 additions & 0 deletions scipy/spatial/qhull.pyx
Expand Up @@ -23,6 +23,8 @@ import os
import sys
import tempfile

np.import_array()

cdef extern from "numpy/npy_math.h":
double nan "NPY_NAN"

Expand Down
7 changes: 7 additions & 0 deletions scipy/spatial/src/distance_pybind.cpp
Expand Up @@ -225,6 +225,13 @@ ArrayDescriptor get_descriptor(const py::array& arr) {
const auto arr_strides = arr.strides();
desc.strides.assign(arr_strides, arr_strides + ndim);
for (intptr_t i = 0; i < ndim; ++i) {
if (arr_shape[i] <= 1) {
// Under NumPy's relaxed stride checking, dimensions with
// 1 or fewer elements are ignored.
desc.strides[i] = 0;
continue;
}

if (desc.strides[i] % desc.element_size != 0) {
throw std::runtime_error("Arrays must be aligned");
}
Expand Down
2 changes: 2 additions & 0 deletions scipy/spatial/transform/rotation.pyx
Expand Up @@ -10,6 +10,8 @@ from cython.view cimport array
from libc.math cimport sqrt, sin, cos, atan2, acos
from numpy.math cimport PI as pi, NAN, isnan # avoid MSVC error

np.import_array()

# utilities for empty array initialization
cdef inline double[:] _empty1(int n):
return array(shape=(n,), itemsize=sizeof(double), format=b"d")
Expand Down
8 changes: 4 additions & 4 deletions scipy/stats/_multivariate.py
Expand Up @@ -396,8 +396,8 @@ def _process_parameters(self, dim, mean, cov):
cov = np.asarray(cov, dtype=float)

if dim == 1:
mean.shape = (1,)
cov.shape = (1, 1)
mean = mean.reshape(1)
cov = cov.reshape(1, 1)

if mean.ndim != 1 or mean.shape[0] != dim:
raise ValueError("Array 'mean' must be a vector of length %d." %
Expand Down Expand Up @@ -4125,8 +4125,8 @@ def _process_parameters(self, loc, shape, df):
dim = loc.size

if dim == 1:
loc.shape = (1,)
shape.shape = (1, 1)
loc = loc.reshape(1)
shape = shape.reshape(1, 1)

if loc.ndim != 1 or loc.shape[0] != dim:
raise ValueError("Array 'loc' must be a vector of length %d." %
Expand Down
2 changes: 2 additions & 0 deletions scipy/stats/_sobol.pyx
Expand Up @@ -6,6 +6,8 @@ cimport numpy as cnp
import os
import numpy as np

cnp.import_array()

# Parameters are linked to the direction numbers list.
# See `initialize_direction_numbers` for more details.
# Declared using DEF to be known at compilation time for ``poly`` et ``vinit``
Expand Down
1 change: 1 addition & 0 deletions scipy/stats/_stats.pyx
Expand Up @@ -12,6 +12,7 @@ import numpy as np
import scipy.stats, scipy.special
cimport scipy.special.cython_special as cs

np.import_array()

cdef double von_mises_cdf_series(double k, double x, unsigned int p):
cdef double s, c, sn, cn, R, V
Expand Down
2 changes: 2 additions & 0 deletions scipy/stats/biasedurn.pyx.templ
Expand Up @@ -7,6 +7,8 @@ cimport numpy as np
import numpy as np
from libcpp.memory cimport unique_ptr

np.import_array()

IF not NPY_OLD:
from numpy.random cimport bitgen_t
from cpython.pycapsule cimport PyCapsule_GetPointer, PyCapsule_IsValid
Expand Down

0 comments on commit 5f587c6

Please sign in to comment.