summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorptmcg <ptmcg@austin.rr.com>2019-09-25 17:15:20 -0500
committerptmcg <ptmcg@austin.rr.com>2019-09-25 17:15:20 -0500
commit9f162858fd274e2748b3993319c2d9ff4d79cdf4 (patch)
treed50021bdd113c8f3d6781f47a4265c1efc1df9bc
parent4c6e4675a7f2aa92c8535741fe8432f3f1656be9 (diff)
downloadpyparsing-git-9f162858fd274e2748b3993319c2d9ff4d79cdf4.tar.gz
Fixed bug in ParserElement.__eq__, addresses issue #123
-rw-r--r--CHANGES7
-rw-r--r--pyparsing.py16
2 files changed, 14 insertions, 9 deletions
diff --git a/CHANGES b/CHANGES
index e1a9462..763b139 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,13 @@
Change Log
==========
+Version 2.4.3 - September, 2019
+-------------------------------
+- Fixed a bug in ParserElement.__eq__ that would for some parsers
+ create a recursion error at parser definition time. Thanks to
+ Michael Clerx for the assist. (Addresses issue #123)
+
+
Version 2.4.2 - July, 2019
--------------------------
- Updated the shorthand notation that has been added for repetition
diff --git a/pyparsing.py b/pyparsing.py
index 3854210..b6d93ef 100644
--- a/pyparsing.py
+++ b/pyparsing.py
@@ -95,8 +95,8 @@ classes inherit from. Use the docstrings for examples of how to:
namespace class
"""
-__version__ = "2.4.2"
-__versionTime__ = "29 Jul 2019 02:58 UTC"
+__version__ = "2.4.3"
+__versionTime__ = "25 Sep 2019 22:10 UTC"
__author__ = "Paul McGuire <ptmcg@users.sourceforge.net>"
import string
@@ -2561,15 +2561,13 @@ class ParserElement(object):
raise exc
def __eq__(self, other):
- if isinstance(other, ParserElement):
- if PY_3:
- self is other or super(ParserElement, self).__eq__(other)
- else:
- return self is other or vars(self) == vars(other)
+ if self is other:
+ return True
elif isinstance(other, basestring):
return self.matches(other)
- else:
- return super(ParserElement, self) == other
+ elif isinstance(other, ParserElement):
+ return vars(self) == vars(other)
+ return False
def __ne__(self, other):
return not (self == other)