mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix for a stupid oversight in the docstring stuff. I left DOTALL off the replace. :(
Here is a fix and a test for the fix.
This commit is contained in:
parent
e98c1fdc8e
commit
dbc97f3b6b
@ -194,7 +194,8 @@ class Parser:
|
||||
# convert docstrings to base64 to avoid all processing. Change the docstring
|
||||
# indicator to something unique with no characters special to the parser.
|
||||
expr = re.sub('(""")(..*?)(""")',
|
||||
lambda mo: self.docstring_sep + as_hex_unicode(mo.group(2)) + self.docstring_sep, expr)
|
||||
lambda mo: self.docstring_sep + as_hex_unicode(mo.group(2)) + self.docstring_sep,
|
||||
expr, flags=re.DOTALL)
|
||||
|
||||
# Strip out escaped backslashes, quotes and parens so that the
|
||||
# lex scanner doesn't get confused. We put them back later.
|
||||
|
@ -391,6 +391,7 @@ class TestSQP(unittest.TestCase):
|
||||
t(r'("""a\1b""" AND """c""" OR d)',
|
||||
'O', '(', 'W', r'a\1b', 'W', 'AND', 'W', 'c', 'W', 'OR', 'W', 'd', 'O', ')')
|
||||
t(r'template:="""a\1b"""', 'W', r'template:=a\1b')
|
||||
t('template:="""a\nb"""', 'W', 'template:=a\nb')
|
||||
t(r'template:"""=a\1b"""', 'W', r'template:=a\1b')
|
||||
t(r'template:"""program: return ("\"1\"")#@#n:1"""', 'W',
|
||||
r'template:program: return ("\"1\"")#@#n:1')
|
||||
|
Loading…
x
Reference in New Issue
Block a user