[pypy-commit] pypy default: Fix the comment and replace again DEFAULT with a singleton, as it is not
arigo
pypy.commits at gmail.com
Wed Jun 29 02:19:13 EDT 2016
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r85441:8a0060eb072f
Date: 2016-06-29 08:18 +0200
http://bitbucket.org/pypy/pypy/changeset/8a0060eb072f/
Log: Fix the comment and replace again DEFAULT with a singleton, as it is
not RPython any more
diff --git a/pypy/interpreter/pyparser/automata.py b/pypy/interpreter/pyparser/automata.py
--- a/pypy/interpreter/pyparser/automata.py
+++ b/pypy/interpreter/pyparser/automata.py
@@ -13,12 +13,11 @@
# PYPY Modification: removed the EMPTY class as it's not needed here
-# PYPY Modification: we don't need a particuliar DEFAULT class here
-# a simple None works fine.
-# (Having a DefaultClass inheriting from str makes
-# the annotator crash)
-DEFAULT = "\00default" # XXX hack, the rtyper does not support dict of with str|None keys
- # anyway using dicts doesn't seem the best final way to store these char indexed tables
+# PYPY Modification: DEFAULT is a singleton, used only in the pre-RPython
+# dicts (see pytokenize.py). Then DFA.__init__() turns these dicts into
+# more compact strings.
+DEFAULT = object()
+
# PYPY Modification : removed all automata functions (any, maybe,
# newArcPair, etc.)
diff --git a/pypy/interpreter/pyparser/genpytokenize.py b/pypy/interpreter/pyparser/genpytokenize.py
--- a/pypy/interpreter/pyparser/genpytokenize.py
+++ b/pypy/interpreter/pyparser/genpytokenize.py
@@ -293,7 +293,7 @@
i = 0
for k, v in sorted(state.items()):
i += 1
- if k == '\x00default':
+ if k == DEFAULT:
k = "automata.DEFAULT"
else:
k = repr(k)
More information about the pypy-commit
mailing list