Skip to content

RecursionError in corner case test of stats.sampling.FastGeneratorInversion (py314, musllinux aarch64) #23172

@rgommers

Description

@rgommers

Ran into this working on Python 3.14 wheels. It only seems to happen for musllinux on aarch64 and on Python 3.14. This is super niche, so I'll just skip the test on musllinux for now. It may be worth looking into in more detail at some point.

  ____________________ test_error_extreme_params[beta-args0] _____________________
  ../venv/lib/python3.14/site-packages/scipy/stats/tests/test_fast_gen_inversion.py:154: in test_error_extreme_params
      rng = FastGeneratorInversion(dist)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          args       = (0.11, 0.11)
          dist       = <scipy.stats._distn_infrastructure.rv_continuous_frozen object at 0xff11fb19cd00>
          distname   = 'beta'
          sup        = <numpy.testing._private.utils.suppress_warnings object at 0xff11d614f610>
  ../venv/lib/python3.14/site-packages/scipy/stats/_sampling.py:701: in __init__
      self._rng = NumericalInversePolynomial(
          args       = (0.11, 0.11)
          d0         = np.float64(0.0)
          d1         = inf
          dist       = <scipy.stats._sampling.CustomDistPINV object at 0xff11d5199810>
          distname   = 'beta'
          domain     = None
          ignore_shape_range = False
          loc        = 0
          nargs      = 2
          nargs_expected = 2
          random_state = None
          scale      = 1
          self       = <scipy.stats._sampling.FastGeneratorInversion object at 0xff11d52369c0>
  scipy/stats/_unuran/unuran_wrapper.pyx:1445: in scipy.stats._unuran.unuran_wrapper.NumericalInversePolynomial.__cinit__
      ???
  scipy/stats/_unuran/unuran_wrapper.pyx:1412: in scipy.stats._unuran.unuran_wrapper.NumericalInversePolynomial.__cinit__._callback_wrapper
      ???
  ../venv/lib/python3.14/site-packages/scipy/stats/_sampling.py:420: in pdf
      return self._pdf(x)
             ^^^^^^^^^^^^
          self       = <scipy.stats._sampling.CustomDistPINV object at 0xff11d5199810>
          x          = 6.256509672447191e-149
  ../venv/lib/python3.14/site-packages/scipy/stats/_sampling.py:417: in <lambda>
      self._pdf = lambda x: pdf(x, *args)
                            ^^^^^^^^^^^^^
          args       = (0.11, 0.11)
          pdf        = <function betaprime_pdf at 0xff11f9a6f7f0>
          x          = 6.256509672447191e-149
  ../venv/lib/python3.14/site-packages/scipy/stats/_sampling.py:39: in betaprime_pdf
      if x > 0:
         ^^^^^
  E   RecursionError: Stack overflow (used 100 kB) in comparison
          a          = 0.11
          b          = 0.11
          x          = 6.256509672447191e-149

Metadata

Metadata

Assignees

No one assigned

    Labels

    defectA clear bug or issue that prevents SciPy from being installed or used as expectedscipy.stats

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions