Merged revisions 82654 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r82654 | mark.dickinson | 2010-07-08 22:15:36 +0100 (Thu, 08 Jul 2010) | 3 lines Issue #9136: Profiling Decimal gave 'dictionary changed size during iteration'. Remove the use of locals() that caused this error. ........
This commit is contained in:
parent
e85aa739ab
commit
9b9e12530d
|
@ -3756,22 +3756,38 @@ class Context(object):
|
||||||
Emin=None, Emax=None,
|
Emin=None, Emax=None,
|
||||||
capitals=None, _clamp=0,
|
capitals=None, _clamp=0,
|
||||||
_ignored_flags=None):
|
_ignored_flags=None):
|
||||||
if flags is None:
|
# Set defaults; for everything except flags and _ignored_flags,
|
||||||
flags = []
|
# inherit from DefaultContext.
|
||||||
|
try:
|
||||||
|
dc = DefaultContext
|
||||||
|
except NameError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
self.prec = prec if prec is not None else dc.prec
|
||||||
|
self.rounding = rounding if rounding is not None else dc.rounding
|
||||||
|
self.Emin = Emin if Emin is not None else dc.Emin
|
||||||
|
self.Emax = Emax if Emax is not None else dc.Emax
|
||||||
|
self.capitals = capitals if capitals is not None else dc.capitals
|
||||||
|
self._clamp = _clamp if _clamp is not None else dc._clamp
|
||||||
|
|
||||||
if _ignored_flags is None:
|
if _ignored_flags is None:
|
||||||
_ignored_flags = []
|
self._ignored_flags = []
|
||||||
if not isinstance(flags, dict):
|
else:
|
||||||
flags = dict([(s, int(s in flags)) for s in _signals])
|
self._ignored_flags = _ignored_flags
|
||||||
del s
|
|
||||||
if traps is not None and not isinstance(traps, dict):
|
if traps is None:
|
||||||
traps = dict([(s, int(s in traps)) for s in _signals])
|
self.traps = dc.traps.copy()
|
||||||
del s
|
elif not isinstance(traps, dict):
|
||||||
for name, val in locals().items():
|
self.traps = dict((s, int(s in traps)) for s in _signals)
|
||||||
if val is None:
|
else:
|
||||||
setattr(self, name, _copy.copy(getattr(DefaultContext, name)))
|
self.traps = traps
|
||||||
else:
|
|
||||||
setattr(self, name, val)
|
if flags is None:
|
||||||
del self.self
|
self.flags = dict.fromkeys(_signals, 0)
|
||||||
|
elif not isinstance(flags, dict):
|
||||||
|
self.flags = dict((s, int(s in flags)) for s in _signals)
|
||||||
|
else:
|
||||||
|
self.flags = flags
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
"""Show the current context."""
|
"""Show the current context."""
|
||||||
|
|
|
@ -510,6 +510,10 @@ What's New in Python 2.7 beta 1?
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue #9136: Fix 'dictionary changed size during iteration'
|
||||||
|
RuntimeError produced when profiling the decimal module. This was
|
||||||
|
due to a dangerous iteration over 'locals()' in Context.__init__.
|
||||||
|
|
||||||
- Issue #7301: Add environment variable $PYTHONWARNINGS.
|
- Issue #7301: Add environment variable $PYTHONWARNINGS.
|
||||||
|
|
||||||
- Issue #8329: Don't return the same lists from select.select when no fds are
|
- Issue #8329: Don't return the same lists from select.select when no fds are
|
||||||
|
|
Loading…
Reference in New Issue