[pypy-svn] r75066 - pypy/branch/unfreeze-encodings/pypy/module/_codecs
arigo at codespeak.net
arigo at codespeak.net
Thu Jun 3 19:45:50 CEST 2010
Author: arigo
Date: Thu Jun 3 19:45:49 2010
New Revision: 75066
Modified:
pypy/branch/unfreeze-encodings/pypy/module/_codecs/interp_codecs.py
Log:
Assert that we don't call lookup_codec() at all during translation.
Modified: pypy/branch/unfreeze-encodings/pypy/module/_codecs/interp_codecs.py
==============================================================================
--- pypy/branch/unfreeze-encodings/pypy/module/_codecs/interp_codecs.py (original)
+++ pypy/branch/unfreeze-encodings/pypy/module/_codecs/interp_codecs.py Thu Jun 3 19:45:49 2010
@@ -2,6 +2,7 @@
from pypy.interpreter.gateway import ObjSpace, NoneNotWrapped, applevel
from pypy.interpreter.baseobjspace import W_Root
from pypy.rlib.rstring import StringBuilder, UnicodeBuilder
+from pypy.rlib.objectmodel import we_are_translated
class CodecState(object):
def __init__(self, space):
@@ -78,6 +79,8 @@
Looks up a codec tuple in the Python codec registry and returns
a tuple of functions.
"""
+ assert not (space.config.translating and not we_are_translated()), \
+ "lookup_codec() should not be called during translation"
state = space.fromcache(CodecState)
normalized_encoding = encoding.replace(" ", "-").lower()
w_result = state.codec_search_cache.get(normalized_encoding, None)
More information about the Pypy-commit
mailing list