File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ cdef class nmod_ctx:
6262 """ Retrieve an nmod context from the cache or create a new one."""
6363 ctx = _nmod_ctx_cache.get(mod)
6464 if ctx is None :
65- _nmod_ctx_cache[mod] = ctx = nmod_ctx._new_ctx(mod)
65+ ctx = _nmod_ctx_cache.setdefault(mod, nmod_ctx._new_ctx(mod) )
6666 return ctx
6767
6868 @staticmethod
Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ cdef class nmod_mat_ctx:
9494 """ Retrieve an nmod_mat context from the cache or create a new one."""
9595 ctx = _nmod_mat_ctx_cache.get(mod)
9696 if ctx is None :
97- _nmod_mat_ctx_cache[mod] = ctx = nmod_mat_ctx._new_ctx(mod)
97+ ctx = _nmod_mat_ctx_cache.setdefault(mod, nmod_mat_ctx._new_ctx(mod) )
9898 return ctx
9999
100100 @staticmethod
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ cdef class nmod_poly_ctx:
4949 """ Retrieve an nmod_poly context from the cache or create a new one."""
5050 ctx = _nmod_poly_ctx_cache.get(mod)
5151 if ctx is None :
52- _nmod_poly_ctx_cache[mod] = ctx = nmod_poly_ctx._new_ctx(mod)
52+ ctx = _nmod_poly_ctx_cache.setdefault(mod, nmod_poly_ctx._new_ctx(mod) )
5353 return ctx
5454
5555 @staticmethod
You can’t perform that action at this time.
0 commit comments