Skip to content

Commit

Permalink
Backport FutureWarning fix (regex with nested set), and runTests refo…
Browse files Browse the repository at this point in the history
…rmat
  • Loading branch information
ptmcg committed Mar 30, 2020
1 parent efc7009 commit 6a844ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Version 2.4.7 - March, 2020
. Traceback abbreviation
. Bug in delta_time example
. Fix regexen in pyparsing_common.real and .sci_real
. Avoid FutureWarning on Python 3.7 or later
. Cleanup output in runTests if comments are embedded in test string


Version 2.4.6 - December, 2019
Expand Down
8 changes: 4 additions & 4 deletions pyparsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"""

__version__ = "2.4.7"
__versionTime__ = "04 Mar 2020 02:48 UTC"
__versionTime__ = "30 Mar 2020 00:43 UTC"
__author__ = "Paul McGuire <ptmcg@users.sourceforge.net>"

import string
Expand Down Expand Up @@ -2740,7 +2740,7 @@ def runTests(self, tests, parseAll=True, comment='#',
continue
if not t:
continue
out = ['\n'.join(comments), t]
out = ['\n' + '\n'.join(comments) if comments else '', t]
comments = []
try:
# convert newline marks to actual newlines, and strip leading BOM if present
Expand Down Expand Up @@ -5452,8 +5452,8 @@ def mustMatchTheseTokens(s, l, t):
return rep

def _escapeRegexRangeChars(s):
# ~ escape these chars: ^-]
for c in r"\^-]":
# ~ escape these chars: ^-[]
for c in r"\^-[]":
s = s.replace(c, _bslash + c)
s = s.replace("\n", r"\n")
s = s.replace("\t", r"\t")
Expand Down

0 comments on commit 6a844ee

Please sign in to comment.