[issue9136] RuntimeError when profiling Decimal

Yuv Gre report at bugs.python.org
Thu Jul 1 00:18:23 CEST 2010

New submission from Yuv Gre <ubershmekel at gmail.com>:

I'm using Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) [MSC v.1500 32 bit (Intel)] on win32. Running the following code:

    import profile
    import math
    import decimal
    def show_bug():
        x = decimal.Decimal.from_float(math.e)**(-2**31)

And I get this stack trace:

Traceback (most recent call last):
  File "C:/Users/Me/Documents/python/temptest", line 15, in <module>
  File "C:\Python31\lib\profile.py", line 70, in run
    prof = prof.run(statement)
  File "C:\Python31\lib\profile.py", line 456, in run
    return self.runctx(cmd, dict, dict)
  File "C:\Python31\lib\profile.py", line 462, in runctx
    exec(cmd, globals, locals)
  File "<string>", line 1, in <module>
  File "C:/Users/Me/Documents/python/temptest", line 8, in show_bug
    x = Decimal.from_float(math.e)**(-2**31)
  File "C:\Python31\lib\decimal.py", line 2212, in __pow__
    context = getcontext()
  File "C:\Python31\lib\decimal.py", line 447, in getcontext
    context = Context()
  File "C:\Python31\lib\decimal.py", line 3777, in __init__
    for name, val in locals().items():
RuntimeError: dictionary changed size during iteration

components: Library (Lib)
messages: 109023
nosy: ubershmekel
priority: normal
severity: normal
status: open
title: RuntimeError when profiling Decimal
type: behavior
versions: Python 3.1

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list