[SciPy-Dev] backporting scipy.stats fixes