32 | | I haven't been able to locate what `parent._modulus` is in this case. I'd assume that's a cython slot too. Then that access would be just as safe as the `._parent` lookup before. |

33 | | At this point perhaps Martin Albrecht, Robert Bradshaw and Yann Laigle-Chapuy can give some enlightenment about the design of the templates and their use in `Polynomial_ZZ_pEX`. |

| 32 | I haven't been able to locate what `parent._modulus` is in this case. However, |

| 33 | {{{ |

| 34 | sage: K.<a>=GF(next_prime(2**60)**3) |

| 35 | sage: R.<x> = PolynomialRing(K,implementation='NTL') |

| 36 | sage: '_modulus' in R.__dict__.keys() |

| 37 | True |

| 38 | }}} |

| 39 | suggests this attribute is stored in a dictionary. It's set in `sage.rings.polynomial.polynomial_ring.PolynomialRing_field.__init__`:1367 |

| 40 | {{{ |

| 41 | if implementation == "NTL" and is_FiniteField(base_ring) and not(sparse): |

| 42 | from sage.libs.ntl.ntl_ZZ_pEContext import ntl_ZZ_pEContext |

| 43 | from sage.libs.ntl.ntl_ZZ_pX import ntl_ZZ_pX |

| 44 | from sage.rings.polynomial.polynomial_zz_pex import Polynomial_ZZ_pEX |

| 45 | |

| 46 | p=base_ring.characteristic() |

| 47 | self._modulus = ntl_ZZ_pEContext(ntl_ZZ_pX(list(base_ring.polynomial()), p)) |

| 48 | element_class = Polynomial_ZZ_pEX |

| 49 | }}} |

| 50 | I guess we've just found that this is not a very good place to store `_modulus`. Where else, though? Would it be enough to have a cythonized version of `PolynomialRing_field` so that `_modulus` can be tied a little tighter to the parent? It seems to me the parent is the right place to store this information. We just need to convince the parent to hold on to its information for a bit longer. |