[pypy-svn] r45344 - in pypy/dist/pypy/interpreter/pyparser: . test

jacob at codespeak.net jacob at codespeak.net
Thu Jul 26 15:13:02 CEST 2007


Author: jacob
Date: Thu Jul 26 15:13:01 2007
New Revision: 45344

Modified:
   pypy/dist/pypy/interpreter/pyparser/future.py
   pypy/dist/pypy/interpreter/pyparser/test/test_futureautomaton.py
Log:
Fixed and enabled the test. Fixed the underlying problem with
not considering escaped characters.


Modified: pypy/dist/pypy/interpreter/pyparser/future.py
==============================================================================
--- pypy/dist/pypy/interpreter/pyparser/future.py	(original)
+++ pypy/dist/pypy/interpreter/pyparser/future.py	Thu Jul 26 15:13:01 2007
@@ -89,7 +89,9 @@
             self.s[self.pos] == self.s[self.pos+2]):
             self.pos += 3
             while 1: # Deal with a triple quoted docstring
-                if self.s[self.pos] != endchar:
+                if self.s[self.pos] == '\\':
+                    self.pos += 2
+                elif self.s[self.pos] != endchar:
                     self.pos += 1
                 else:
                     self.pos += 1

Modified: pypy/dist/pypy/interpreter/pyparser/test/test_futureautomaton.py
==============================================================================
--- pypy/dist/pypy/interpreter/pyparser/test/test_futureautomaton.py	(original)
+++ pypy/dist/pypy/interpreter/pyparser/test/test_futureautomaton.py	Thu Jul 26 15:13:01 2007
@@ -30,10 +30,9 @@
     assert f.pos == len(s)
 
 def test_escapedquote_in_tripledocstring():
-    py.test.skip("wrong handling of backslash escapes in triple quoted strings")
     s = '''""" This is a
 docstring with line
-breaks in it. \"""It even has an escaped quote!"""
+breaks in it. \\"""It even has an escaped quote!"""
 '''
     f = run(s)
     assert f.pos == len(s)



More information about the Pypy-commit mailing list