def _not_a_coeff(expr):
    return expr in [S.NaN, S.Infinity, S.NegativeInfinity, S.ComplexInfinity]
Do not treat NaN and infinities as valid polynomial coefficients.
dataset/ETHPy150Open sympy/sympy/sympy/polys/polyutils.py/_not_a_coeff