Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: 1.9.3 backports #17239

merged 50 commits into from Oct 19, 2022


Copy link

@tylerjereddy tylerjereddy commented Oct 16, 2022

Backport 37 PRs after manually curating merges to main that seemed suitable for backporting. Only gh-17200 had a merge conflict to resolve, in the meson build system. List of backports is below; I didn't have the steam to fixup .mailmap but that's a lot of PRs so some names in author list probably could use a cleanup, though that's at least not critical I suppose.

drpeteb and others added 30 commits October 16, 2022 14:33
… when covariance is singular (scipy#5288)

Co-authored-by: Matt Haberland <>
Co-authored-by: Tirth Patel <>
…uld print convergence info from final iteration. (scipy#13322)

* BUG: optimize: fixed 13321
A bug in the way the `iprint` and `disp` arguments were handled
made it impossible to run the code with `iprint=0`, since it was
overwritten from the `disp` handling.

Co-authored-by: Matt Haberland <>
* BUG: stats: Reformulate loggamma._rvs to handle c << 1.

Closes scipygh-11094.

Several tests in call loggamma.rvs to generate
test data.  These tests have hardcoded expected results that
depend on the values in the input data.  Because the stream
of variates generated by loggamma.rvs has changed, those tests
will fail if the input data is generated by loggamma.rvs.  Instead,
the data that was generated by a new function that takes the log of random variates from `stats.gamma.rvs`.

Co-authored-by: Matt Haberland <>
* BUG: fix powell evaluated outside limits

Co-authored-by: Joseph T. Iosue <>

The documentation of `rv_histogram` was ambiguous about what it expected as input when bin sizes vary: counts or density? Adding to the confusion, the default behavior of `rv_histogram` was to assume that the input was a density, whereas the default of `np.histogram` is to produce bin counts. To resolve this, this PR adds a parameter `density` so that the user can specify whether the input is to be treated as counts or probability density. Because the default is different from that of `np.histogram`, this also warns the user to pass `density` explicitly.

Co-authored-by: Matt Haberland <>
Caused by an OOB access due to uninitialized local variables.

Fixes scipy#3691.
…ero (scipy#16460)

MAINT: stats.ttest_ind: randomized permutation pvalue should not be zero  

Co-authored-by: Matt Haberland <>
* Fix bug scipy#14589 where arguments to objective function aren't passed properly

Co-authored-by: J. J. Ramsey <>

With numpy 1.22.x f2py, dimension of isuppz in syevr is mistranslated.
Avoid this by explicitly specifying operator priority with parenthesis.

Fixes scipy#16527
Co-authored-by: Pamphile Roy <>
to guard against /detect the integer overflow

Co-authored-by: peterbell10 <>
Also cast integers to npy_intp, because cannot use size_t in
PyArray_SimpleNew et al (it expects signed integers)

Co-authored-by: Matthew Brett <>
The file maybe used to be autogenerated, but has since been updated manually
many times over by several people on several occasions. The autogeneration
script is also long gone, too.

For completeness, the original version (or a close approximation to it)
is now available at ---
this repository content is from a Waybackmachine archive of Travis Oliphant's
website, found by Matthew Brett. The archive was trawled on September 29 2000.

Co-authored-by: Matthew Brett <>
Make sure that the product mx*my is <= min(max NPY_INTP, fortan int)
to avoid an overflow on both C and Fortran sides on 32- and 64-bit
systems with and without HAVE_ILP64 (which make Fortran ints 32- or 64-bit, too)
When a sparse matrix was indexed with an argument that was effectively
empty (e.g. `0:0:2`, `[]`, `[False, False]`), the dtype of the matrix
was lost and the result became float64.

Closes scipygh-16656.
awvwgk and others added 9 commits October 16, 2022 15:00
Change `lamv` implementation to use intended branching for assignment
to variable `cs` and avoid useless assignment to implicitly typed
variable `elsecs`.

See scipy#17104
See lfortran/lfortran#779

Signed-off-by: Sebastian Ehlert <>
When SCIPY_XSLOW is defined, the tests `test_riemann_zeta` and `test_zetac`
(that compare the results of `zeta` and `zetac` to the results computed
with `mpmath`) are run with 5000 points, and it turns out that the input
value 1 is included in that case.  The SciPy functions returns `inf`, but
`mpmath.zeta(1)` raises an exception, and that caused the tests to fail.

The fix is to wrap the `mpmath` function to return `mpmath.inf` when the
input is 1.  After fixing that, both tests then failed because some inputs
result in a relative error of roughly 2e-13, so I bumped the tolerance up
to 5e-13.
[ci skip]

Co-authored-by: GavinZhang <>
Co-authored-by: Ralf Gommers <>
All could using `#include <thread>` needs to have this `thread_dep`
dependency. HiGHS code was missing it, and for `stats/_qmc_cy.pyx`
it was incorrectly specified.

It's wrong in the distutils build as well, but let's ignore that
since it's much harder to change and we'll get rid of that build

See scipygh-17193 for the type of compile error this causes.

[ci skip]
…escription (scipy#17204)

DOC: stats.mode: add versionadded tag and correct order of keepdims description
Shebangs do not work this way, but Meson could usually paper over the
differences by noticing that the last element is "python3" and rewiring
it to use its own sys.executable. However, this failed on WSL, likely
because platform quirks meant the script was directly executable, while
simultaneously having a shebang that was a fatal error.

Use a standard shebang indicating this script would like to run with
some form of python3 (which is exactly what it needs).

Fixes scipy#17020
@tylerjereddy tylerjereddy added the maintenance Items related to regular maintenance tasks label Oct 16, 2022
@tylerjereddy tylerjereddy added this to the 1.9.3 milestone Oct 16, 2022
Copy link
Contributor Author

The 1 test failure I see looks like an easy fix--probably the result of cherry-picking a patch that depended on an import that didn't exist on the maintenance branch.

* fix missing import from cherry-picked patch
Copy link
Contributor Author

DeprecationWarning: NumPy will stop allowing conversion of out-of-bound Python integers to integer arrays. The conversion of -1 to uint8 will fail in the future. I'm pretty sure Ralf and Sebastian were talking about a fix that already happened for that recently on main. I haven't check if that is appropriate for backporting but maybe.

Copy link

The deprecation of out-of-bound integers was handled in #17209. It should be fine to backport that if necessary.

WarrenWeckesser and others added 2 commits October 17, 2022 17:25
After the change in numpy/numpy#22385, numpy
raises a deprecation warning with calls such as np.int8(5000) and
np.uint32(-1).  This change avoids such calls in the tests.
Copy link
Contributor Author

thanks, I backported that as well, I'll probably merge in the next day or two if nobody has reason to object, and then turn my attention to 1.9.3 release process

Copy link

@rgommers rgommers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, thanks for that very comprehensive checking and backporting @tylerjereddy

@tylerjereddy tylerjereddy merged commit 25e6b90 into scipy:maintenance/1.9.x Oct 19, 2022
27 checks passed
@tylerjereddy tylerjereddy deleted the treddy_backport_193 branch October 19, 2022 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
maintenance Items related to regular maintenance tasks
None yet

Successfully merging this pull request may close these issues.

None yet