MCPcopy Create free account
hub / github.com/python/cpython / __init__

Method __init__

Modules/_decimal/tests/deccheck.py:191–202  ·  view source on GitHub ↗

Initialization is from the C context

(self, c_ctx=None, p_ctx=None)

Source from the content-addressed store, hash-verified

189 __slots__ = ['c', 'p']
190
191 def __init__(self, c_ctx=None, p_ctx=None):
192 """Initialization is from the C context"""
193 self.c = C.getcontext() if c_ctx is None else c_ctx
194 self.p = P.getcontext() if p_ctx is None else p_ctx
195 self.p.prec = self.c.prec
196 self.p.Emin = self.c.Emin
197 self.p.Emax = self.c.Emax
198 self.p.rounding = self.c.rounding
199 self.p.capitals = self.c.capitals
200 self.settraps([sig for sig in self.c.traps if self.c.traps[sig]])
201 self.setstatus([sig for sig in self.c.flags if self.c.flags[sig]])
202 self.p.clamp = self.c.clamp
203
204 def __str__(self):
205 return str(self.c) + '\n' + str(self.p)

Callers

nothing calls this directly

Calls 2

settrapsMethod · 0.95
setstatusMethod · 0.95

Tested by

no test coverage detected