[pypy-svn] r75666 - in pypy/branch/interplevel-codecs/pypy: interpreter/pyparser module/_codecs

afa at codespeak.net afa at codespeak.net
Tue Jun 29 18:04:26 CEST 2010


Author: afa
Date: Tue Jun 29 18:04:25 2010
New Revision: 75666

Modified:
   pypy/branch/interplevel-codecs/pypy/interpreter/pyparser/parsestring.py
   pypy/branch/interplevel-codecs/pypy/module/_codecs/interp_codecs.py
Log:
Remove the "unicode" parameter.
In CPython this code is disabled with a "#ifndef Py_USING_UNICODE"


Modified: pypy/branch/interplevel-codecs/pypy/interpreter/pyparser/parsestring.py
==============================================================================
--- pypy/branch/interplevel-codecs/pypy/interpreter/pyparser/parsestring.py	(original)
+++ pypy/branch/interplevel-codecs/pypy/interpreter/pyparser/parsestring.py	Tue Jun 29 18:04:25 2010
@@ -96,7 +96,7 @@
     enc = None
     if need_encoding:
          enc = encoding
-    v = PyString_DecodeEscape(space, substr, unicode, enc)
+    v = PyString_DecodeEscape(space, substr, enc)
     return space.wrap(v)
 
 def hexbyte(val):
@@ -105,10 +105,9 @@
         result = "0" + result
     return result
 
-def PyString_DecodeEscape(space, s, unicode, recode_encoding):
+def PyString_DecodeEscape(space, s, recode_encoding):
     """
-    Unescape a backslash-escaped string. If unicode is non-zero,
-    the string is a u-literal. If recode_encoding is non-zero,
+    Unescape a backslash-escaped string. If recode_encoding is non-zero,
     the string is UTF-8 encoded and should be re-encoded in the
     specified encoding.
     """
@@ -171,9 +170,6 @@
                 raise_app_valueerror(space, 'invalid \\x escape')
             # ignored replace and ignore for now
 
-        elif unicode and (ch == 'u' or ch == 'U' or ch == 'N'):
-            raise_app_valueerror(space, 'Unicode escapes not legal '
-                                        'when Unicode disabled')
         else:
             # this was not an escape, so the backslash
             # has to be added, and we start over in

Modified: pypy/branch/interplevel-codecs/pypy/module/_codecs/interp_codecs.py
==============================================================================
--- pypy/branch/interplevel-codecs/pypy/module/_codecs/interp_codecs.py	(original)
+++ pypy/branch/interplevel-codecs/pypy/module/_codecs/interp_codecs.py	Tue Jun 29 18:04:25 2010
@@ -642,5 +642,5 @@
 @unwrap_spec(ObjSpace, str, str)
 def escape_decode(space, data, errors='strict'):
     from pypy.interpreter.pyparser.parsestring import PyString_DecodeEscape
-    result = PyString_DecodeEscape(space, data, False, None)
+    result = PyString_DecodeEscape(space, data, None)
     return space.newtuple([space.wrap(result), space.wrap(len(data))])



More information about the Pypy-commit mailing list