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:
154
154
flint_cleanup()
155
155
156
156
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 :
160
165
raise ValueError (" two different precisions requested" )
161
166
162
167
self .ctx = ctx
@@ -170,10 +175,10 @@ class PrecisionManager:
170
175
_oldprec = self .ctx.prec
171
176
172
177
try :
173
- if self .eprec is not None :
178
+ if self .eprec ! = - 1 :
174
179
self .ctx.prec = self .eprec
175
180
176
- if self .edps is not None :
181
+ if self .edps ! = - 1 :
177
182
self .ctx.dps = self .edps
178
183
179
184
return func(* args, ** kwargs)
@@ -185,10 +190,10 @@ class PrecisionManager:
185
190
def __enter__ (self ):
186
191
self ._oldprec = self .ctx.prec
187
192
188
- if self .eprec is not None :
193
+ if self .eprec ! = - 1 :
189
194
self .ctx.prec = self .eprec
190
195
191
- if self .edps is not None :
196
+ if self .edps ! = - 1 :
192
197
self .ctx.dps = self .edps
193
198
194
199
def __exit__ (self , type , value , traceback ):
You can’t perform that action at this time.
0 commit comments