Armin Rigo <[email protected]> added the comment:

pypy_bug_ukey.py shows an example where it is expected to get MemoryError: you
are building a so-called "unicode strategy" dictionary, which means a dict that
is specialized to store unicode objects only as keys.  But then when you try to
look up an object of a different type --- like string --- it will fall back the
whole dictionary to a general-typed dictionary.  In this case we run out of
memory trying to make the general-typed copy.

This is done because the alternative is harder to implement: that would be
trying to search the internal unicode-only dictionary for a plain string object.
 The drawback is mainly that it is surprizing to get a MemoryError on a plain
lookup, but otherwise the drawback is generally relatively minor, except in
special cases like yours.

________________________________________
PyPy bug tracker <[email protected]>
<https://bugs.pypy.org/issue1608>
________________________________________
_______________________________________________
pypy-issue mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to