sage: R.<x> = PolynomialRing(Zp(17), sparse=True)
sage: x**(10**10)
Traceback (most recent call last)
...
MemoryError:
This should work (and be fast). The solution is probably in the file polynomial_ring_constructor.py in the function single_variate.