[pypy-dev] Correction for the annotation process

Amaury Forgeot D Arc Amaury.Forgeotdarc at Ubitrade.Com
Fri Sep 30 19:07:17 CEST 2005


Hello,

Here is my patch to let the translation go to the end.
For the first chunk, it's not really a correction, but
I don't know how to code this for the tuplebuilder...


C:\dev\pypy\dist-pypy\pypy\interpreter>svn diff
Index: pyparser/pythonparse.py
===================================================================
--- pyparser/pythonparse.py     (revision 17980)
+++ pyparser/pythonparse.py     (working copy)
@@ -34,8 +34,8 @@
             enc = 'utf-8'
         else:
             enc = _normalize_encoding(_check_for_encoding(textsrc))
-            if enc is not None and enc not in ('utf-8', 'iso-8859-1'):
-                textsrc = recode_to_utf8(builder.space, textsrc, enc)
+            #if enc is not None and enc not in ('utf-8', 'iso-8859-1'):
+            #    textsrc = recode_to_utf8(builder.space, textsrc, enc)

         lines = [line + '\n' for line in textsrc.split('\n')]
         builder.source_encoding = enc
@@ -89,11 +89,14 @@
     eol = s.find('\n')
     if eol == -1:
         return _check_line_for_encoding(s)
+    assert eol >= 0
     enc = _check_line_for_encoding(s[:eol])
-    eol2 = s.find('\n', eol + 1)
+    eol = eol + 1
+    eol2 = s.find('\n', eol)
     if eol2 == -1:
-        return _check_line_for_encoding(s[eol + 1:])
-    return _check_line_for_encoding(s[eol + 1:eol2])
+        return _check_line_for_encoding(s[eol:])
+    assert eol2 >= 0
+    return _check_line_for_encoding(s[eol:eol2])

 def _check_line_for_encoding(line):
     """returns the declared encoding or None"""

--
Amaury Forgeot d'Arc
Ubix Development
www.ubitrade.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20050930/49bb3a80/attachment.html>


More information about the Pypy-dev mailing list