| 3900 | """ |
| 3901 | |
| 3902 | def __init__(self, prec=None, rounding=None, Emin=None, Emax=None, |
| 3903 | capitals=None, clamp=None, flags=None, traps=None, |
| 3904 | _ignored_flags=None): |
| 3905 | # Set defaults; for everything except flags and _ignored_flags, |
| 3906 | # inherit from DefaultContext. |
| 3907 | try: |
| 3908 | dc = DefaultContext |
| 3909 | except NameError: |
| 3910 | pass |
| 3911 | |
| 3912 | self.prec = prec if prec is not None else dc.prec |
| 3913 | self.rounding = rounding if rounding is not None else dc.rounding |
| 3914 | self.Emin = Emin if Emin is not None else dc.Emin |
| 3915 | self.Emax = Emax if Emax is not None else dc.Emax |
| 3916 | self.capitals = capitals if capitals is not None else dc.capitals |
| 3917 | self.clamp = clamp if clamp is not None else dc.clamp |
| 3918 | |
| 3919 | if _ignored_flags is None: |
| 3920 | self._ignored_flags = [] |
| 3921 | else: |
| 3922 | self._ignored_flags = _ignored_flags |
| 3923 | |
| 3924 | if traps is None: |
| 3925 | self.traps = dc.traps.copy() |
| 3926 | elif not isinstance(traps, dict): |
| 3927 | self.traps = dict((s, int(s in traps)) for s in _signals + traps) |
| 3928 | else: |
| 3929 | self.traps = traps |
| 3930 | |
| 3931 | if flags is None: |
| 3932 | self.flags = dict.fromkeys(_signals, 0) |
| 3933 | elif not isinstance(flags, dict): |
| 3934 | self.flags = dict((s, int(s in flags)) for s in _signals + flags) |
| 3935 | else: |
| 3936 | self.flags = flags |
| 3937 | |
| 3938 | def _set_integer_check(self, name, value, vmin, vmax): |
| 3939 | if not isinstance(value, int): |