summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorptmcg <ptmcg@9bf210a0-9d2d-494c-87cf-cfb32e7dff7b>2014-08-16 05:20:39 +0000
committerptmcg <ptmcg@9bf210a0-9d2d-494c-87cf-cfb32e7dff7b>2014-08-16 05:20:39 +0000
commit8454ef5f2a7a6b4f1a04953f7bbc90fcb22b4a61 (patch)
treec630b81da1a7910c53a226c6b85ece4ea215af18
parent61ebdf1d8b766e7f08d46b8e99a42af8df5874ce (diff)
downloadpyparsing-8454ef5f2a7a6b4f1a04953f7bbc90fcb22b4a61.tar.gz
Fixed bug in ParseResults __init__ method, when returning non-ParseResults types from parse actions that implement __eq__.
git-svn-id: svn://svn.code.sf.net/p/pyparsing/code/trunk@276 9bf210a0-9d2d-494c-87cf-cfb32e7dff7b
-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: