[pypy-commit] pypy default: Remove dead code.

amauryfa noreply at buildbot.pypy.org
Wed Mar 28 23:26:10 CEST 2012


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: 
Changeset: r54046:3b48363cff78
Date: 2012-03-28 23:24 +0200
http://bitbucket.org/pypy/pypy/changeset/3b48363cff78/

Log:	Remove dead code. Q: Where does it come from? A: from CPython:
	Python/ast.c Q: Why this code in CPython? A: In file
	Grammar/Grammar, keywords and operators are enclosed in quotes
	('def', '+='); grammar.c contains logic to create the various
	tokens, and separate keywords from operators; probably in old
	ages the same code was used to parse the Python language as well.

diff --git a/pypy/interpreter/pyparser/parsestring.py b/pypy/interpreter/pyparser/parsestring.py
--- a/pypy/interpreter/pyparser/parsestring.py
+++ b/pypy/interpreter/pyparser/parsestring.py
@@ -23,21 +23,18 @@
     rawmode = False
 
     # string decoration handling
-    o = ord(quote)
-    isalpha = (o>=97 and o<=122) or (o>=65 and o<=90)
-    if isalpha or quote == '_':
-        if quote == 'b' or quote == 'B':
-            ps += 1
-            quote = s[ps]
-            unicode_literal = False
-        elif quote == 'u' or quote == 'U':
-            ps += 1
-            quote = s[ps]
-            unicode_literal = True
-        if quote == 'r' or quote == 'R':
-            ps += 1
-            quote = s[ps]
-            rawmode = True
+    if quote == 'b' or quote == 'B':
+        ps += 1
+        quote = s[ps]
+        unicode_literal = False
+    elif quote == 'u' or quote == 'U':
+        ps += 1
+        quote = s[ps]
+        unicode_literal = True
+    if quote == 'r' or quote == 'R':
+        ps += 1
+        quote = s[ps]
+        rawmode = True
     if quote != "'" and quote != '"':
         raise_app_valueerror(space,
                              'Internal error: parser passed unquoted literal')


More information about the pypy-commit mailing list