[pypy-svn] r58355 - pypy/branch/2.5-features/pypy/module/_codecs
fijal at codespeak.net
fijal at codespeak.net
Tue Sep 23 00:54:26 CEST 2008
Author: fijal
Date: Tue Sep 23 00:54:24 2008
New Revision: 58355
Modified:
pypy/branch/2.5-features/pypy/module/_codecs/__init__.py
pypy/branch/2.5-features/pypy/module/_codecs/app_codecs.py
pypy/branch/2.5-features/pypy/module/_codecs/interp_codecs.py
Log:
General whack-until-it-works coding. Does not behave exactly like in cpython,
but the question is do we care? This opaque object seems to have no public
interface anyway.
Modified: pypy/branch/2.5-features/pypy/module/_codecs/__init__.py
==============================================================================
--- pypy/branch/2.5-features/pypy/module/_codecs/__init__.py (original)
+++ pypy/branch/2.5-features/pypy/module/_codecs/__init__.py Tue Sep 23 00:54:24 2008
@@ -21,6 +21,7 @@
'utf_7_decode' : 'app_codecs.utf_7_decode',
'utf_7_encode' : 'app_codecs.utf_7_encode',
'_register_existing_errors': 'app_codecs._register_existing_errors',
+ 'charmap_build' : 'app_codecs.charmap_build'
}
interpleveldefs = {
'encode': 'interp_codecs.encode',
Modified: pypy/branch/2.5-features/pypy/module/_codecs/app_codecs.py
==============================================================================
--- pypy/branch/2.5-features/pypy/module/_codecs/app_codecs.py (original)
+++ pypy/branch/2.5-features/pypy/module/_codecs/app_codecs.py Tue Sep 23 00:54:24 2008
@@ -93,7 +93,6 @@
def charmap_encode(obj, errors='strict', mapping='latin-1'):
"""None
"""
-
res = PyUnicode_EncodeCharmap(obj, len(obj), mapping, errors)
res = ''.join(res)
return res, len(res)
@@ -600,13 +599,6 @@
p += p[1]
return p
-
-def PyUnicode_DecodeMBCS(s, size, errors):
- pass
-
-def PyUnicode_EncodeMBCS(p, size, errors):
- pass
-
def unicode_call_errorhandler(errors, encoding,
reason, input, startinpos, endinpos, decode=True):
@@ -951,3 +943,13 @@
pos += count
return p
+
+def charmap_build(somestring):
+ m = {}
+ num = 0
+ for elem in somestring:
+ m[ord(elem)] = num
+ num += 1
+ return m
+
+
Modified: pypy/branch/2.5-features/pypy/module/_codecs/interp_codecs.py
==============================================================================
--- pypy/branch/2.5-features/pypy/module/_codecs/interp_codecs.py (original)
+++ pypy/branch/2.5-features/pypy/module/_codecs/interp_codecs.py Tue Sep 23 00:54:24 2008
@@ -76,7 +76,6 @@
Looks up a codec tuple in the Python codec registry and returns
a tuple of functions.
"""
- #import pdb; pdb.set_trace()
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