diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2008-05-03 18:23:14 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2008-05-03 18:23:14 (GMT) |
commit | 1840c1abcade9215faf91b701ab4525ba948d9dc (patch) | |
tree | 78c0104da7d1baf853443b320ee8421076289694 /Lib/decimal.py | |
parent | 2b30ea068fdac34a7bbeb5d3cf90796f5034aea6 (diff) | |
download | cpython-1840c1abcade9215faf91b701ab4525ba948d9dc.zip cpython-1840c1abcade9215faf91b701ab4525ba948d9dc.tar.gz cpython-1840c1abcade9215faf91b701ab4525ba948d9dc.tar.bz2 |
Backport Raymond's changes in r60508 to Python 2.6.
'Context flags get set, not incremented'
Diffstat (limited to 'Lib/decimal.py')
-rw-r--r-- | Lib/decimal.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/decimal.py b/Lib/decimal.py index aee558a..13e2239 100644 --- a/Lib/decimal.py +++ b/Lib/decimal.py @@ -3593,7 +3593,7 @@ class Context(object): traps - If traps[exception] = 1, then the exception is raised when it is caused. Otherwise, a value is substituted in. - flags - When an exception is caused, flags[exception] is incremented. + flags - When an exception is caused, flags[exception] is set. (Whether or not the trap_enabler is set) Should be reset by user of Decimal instance. Emin - Minimum exponent @@ -3661,16 +3661,16 @@ class Context(object): """Handles an error If the flag is in _ignored_flags, returns the default response. - Otherwise, it increments the flag, then, if the corresponding + Otherwise, it sets the flag, then, if the corresponding trap_enabler is set, it reaises the exception. Otherwise, it returns - the default value after incrementing the flag. + the default value after setting the flag. """ error = _condition_map.get(condition, condition) if error in self._ignored_flags: # Don't touch the flag return error().handle(self, *args) - self.flags[error] += 1 + self.flags[error] = 1 if not self.traps[error]: # The errors define how to handle themselves. return condition().handle(self, *args) |