summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CHANGES4
-rw-r--r--src/pyparsing.py4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/CHANGES b/src/CHANGES
index 687745c..2fe5905 100644
--- a/src/CHANGES
+++ b/src/CHANGES
@@ -21,6 +21,10 @@ Version 2.0.3 -
- Fixed UnboundLocalError under Python 3.4 in oneOf method, reported
on Sourceforge by aldanor, thanks!
+- Fixed bug in ParseResults __init__ method, when returning non-ParseResults
+ types from parse actions that implement __eq__. Raised during discussion
+ on the pyparsing wiki with cyrfer.
+
Version 2.0.2 - April, 2014
---------------------------
diff --git a/src/pyparsing.py b/src/pyparsing.py
index 1cc0185..7b82f71 100644
--- a/src/pyparsing.py
+++ b/src/pyparsing.py
@@ -58,7 +58,7 @@ The pyparsing module handles some of the problems that are typically vexing when
"""
__version__ = "2.0.3"
-__versionTime__ = "12 Aug 2014 09:57"
+__versionTime__ = "16 Aug 2014 00:12"
__author__ = "Paul McGuire <ptmcg@users.sourceforge.net>"
import string
@@ -300,7 +300,7 @@ class ParseResults(object):
if isinstance(name,int):
name = _ustr(name) # will always return a str, but use _ustr for consistency
self.__name = name
- if not toklist in (None,'',[]):
+ if not (isinstance(toklist, (type(None), basestring, list)) and toklist in (None,'',[])):
if isinstance(toklist,basestring):
toklist = [ toklist ]
if asList: