Skip to content

community/py3-patsy: fix tests with numpy 2.0

mio requested to merge mio/aports:py3-patsy into master

Update numpy array copy references for numpy 2.0 compatibility. Resolves rebuild failure due to failed tests on the 3.21 builders (error log).

a = [1, 2, 3], copy = False, dtype = None, subok = False

    def asarray_or_pandas(a, copy=False, dtype=None, subok=False):
        if have_pandas:
            if isinstance(a, (pandas.Series, pandas.DataFrame)):
                # The .name attribute on Series is discarded when passing through
                # the constructor:
                #   https://github.com/pydata/pandas/issues/1578
                extra_args = {}
                if hasattr(a, "name"):
                    extra_args["name"] = a.name
                return a.__class__(a, copy=copy, dtype=dtype, **extra_args)
>       return np.array(a, copy=copy, dtype=dtype, subok=subok)
E       ValueError: Unable to avoid copy while creating an array as requested.
E       If using `np.array(obj, copy=False)` replace it with `np.asarray(obj)` to allow a copy when needed (no behavior change in NumPy 1.x).
E       For more details, see https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword.

patsy/util.py:67: ValueError

Note: upstream requested a change in the numpy version check logic in the patch MR, though it has minimal impact on the aport which only builds against numpy 2.

Edited by mio

Merge request reports

Loading