File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -154,9 +154,14 @@ cdef class FlintContext:
154154 flint_cleanup()
155155
156156
157- class PrecisionManager :
158- def __init__ (self , ctx , eprec = None , edps = None ):
159- if eprec is not None and edps is not None :
157+ cdef class PrecisionManager:
158+ cdef FlintContext ctx
159+ cdef int eprec
160+ cdef int edps
161+ cdef int _oldprec
162+
163+ def __init__ (self , ctx , eprec = - 1 , edps = - 1 ):
164+ if eprec != - 1 and edps != - 1 :
160165 raise ValueError (" two different precisions requested" )
161166
162167 self .ctx = ctx
@@ -170,10 +175,10 @@ class PrecisionManager:
170175 _oldprec = self .ctx.prec
171176
172177 try :
173- if self .eprec is not None :
178+ if self .eprec ! = - 1 :
174179 self .ctx.prec = self .eprec
175180
176- if self .edps is not None :
181+ if self .edps ! = - 1 :
177182 self .ctx.dps = self .edps
178183
179184 return func(* args, ** kwargs)
@@ -185,10 +190,10 @@ class PrecisionManager:
185190 def __enter__ (self ):
186191 self ._oldprec = self .ctx.prec
187192
188- if self .eprec is not None :
193+ if self .eprec ! = - 1 :
189194 self .ctx.prec = self .eprec
190195
191- if self .edps is not None :
196+ if self .edps ! = - 1 :
192197 self .ctx.dps = self .edps
193198
194199 def __exit__ (self , type , value , traceback ):
You can’t perform that action at this time.
0 commit comments