
    xKgP
                     n    d Z ddlZddlZ ej                  dd      dd       Zd Zedk(  r e        yy)	a  
This is a testcase for https://github.com/numba/numba/issues/9490.
The bug is very sensitive to the control-flow and variable uses.
It is impossible to shrink the reproducer in any meaningful way.

The test is also sensitive to PYTHONHASHSEED.
PYTHONHASHSEED=1 will trigger the bug.

Example of traceback:

  File "/numba/parfors/parfor.py", line 2070, in _arrayexpr_to_parfor
    index_vars, loopnests = _mk_parfor_loops(pass_states.typemap, size_vars,
                                             scope, loc)
  File "/numba/parfors/parfor.py", line 1981, in _mk_parfor_loops
    for size_var in size_vars:
TypeError: Failed in nopython mode pipeline (step: convert to parfors)
'NoneType' object is not iterable
    NT)nopythonparallelc           	         t        | j                  d   dz        }t        j                  | j                  d   |j                  d   ft        j                        }t        j
                  |t        j                        }t        j                  |j                  d         }t        j                  |j                  d         D ]y  }|d d |f   }t        j                  |      }	| |	    }
||	    }d}t        t        |      |dz
  d      D ]  }|| d  }|
| d  }t        j                  j                  t        j                  |j                   |      t        j                  |j                   |            }t        j                  ||      |z
  }t        j"                  t        j$                  |dz              }t        j&                  |d         |z  |k  }t        j&                  |d         |z  |k  }t        j&                  |d         |z  |k  }||z  |z  }|s n |d d |f<   | d |f<   |||<   | |||j)                  t        j*                        fS )	N   g      ?)dtypeF   r   )intshapenpzerosfloat64	full_likenanemptynumbaprangeisnanrangelenlinalgsolvedotTsqrtmeanfabsastypebool_)Xy	thresholdmin_obsbeta	residualsstableidxy_subisnaX_sub	is_stablejdxy_X_beta_sub	resid_subrmsefirstlastslopes                        f/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/numba/tests/parfor_iss9490_usecase.py
stable_fitr7      s   !''!*s"#G88QWWQZ,BJJ?DQ'IXXqwwqz#F||AGGAJ'!S&	xx4%te	 UWq["5C tuBtuByyrvvbddB'7b9IJHr8,r1I772779>23DGGIaL)D09<E779R=)D09<DGGHQK(4/);E,I 6"  QV )	3$%*s9 (: FMM"((333    c                     t         j                  j                  d       d} d}t         j                  j                  |       }t         j                  j                  |      }t        ||      \  }}}t        j	                  ||      \  }}}	t         j
                  j                  ||       t         j
                  j                  ||       t         j
                  j                  ||	       y )Nr   )
      )r:      )r   randomseedr7   py_functestingassert_allclose)
X_shapey_shaper!   r"   got_betagot_residuals
got_stableexp_betaexp_residuals
exp_stables
             r6   checkrJ   >   s    IINN1GG
		!A
		!A*4Q*:'HmZ*4*<*<Q*B'HmZJJx2JJ}m<JJz:6r8   __main__)   )__doc__r   numpyr   jitr7   rJ   __name__ r8   r6   <module>rR      sM   &   D4("4 )"4J7 z	G r8   