From 7ea8ba4efc516a84b1c5037d3d1e3a13b8374c8b Mon Sep 17 00:00:00 2001 From: Marcel Plch Date: Mon, 10 Jun 2019 14:59:53 +0200 Subject: [PATCH] Backport aditional rstring fixes --- pycparser-2.14-rstring_fix.patch | 46 ++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/pycparser-2.14-rstring_fix.patch b/pycparser-2.14-rstring_fix.patch index 2385ad3..49eb8bf 100644 --- a/pycparser-2.14-rstring_fix.patch +++ b/pycparser-2.14-rstring_fix.patch @@ -12,3 +12,49 @@ diff -ru pycparser-release_v2.14/pycparser/c_lexer.py pycparser-release_v2.14_pa def build(self, **kwargs): """ Builds the lexer from the specification. Must be +diff -ru pycparser-release_v2.14/pycparser/c_lexer.py.ply pycparser-release_v2.14_patched/pycparser/c_lexer.py.ply +--- pycparser-release_v2.14/pycparser/c_lexer.py.ply 2015-06-10 05:00:55.000000000 +0200 ++++ pycparser-release_v2.14_patched/pycparser/c_lexer.py.ply 2019-06-06 15:53:44.972385501 +0200 +@@ -52,8 +52,8 @@ + # Allow either "# line" or "# " to support GCC's + # cpp output + # +- self.line_pattern = re.compile('([ \t]*line\W)|([ \t]*\d+)') +- self.pragma_pattern = re.compile('[ \t]*pragma\W') ++ self.line_pattern = re.compile(r'([ \t]*line\W)|([ \t]*\d+)') ++ self.pragma_pattern = re.compile(r'[ \t]*pragma\W') + + def build(self, **kwargs): + """ Builds the lexer from the specification. Must be +diff -ru pycparser-release_v2.14/tests/test_c_lexer.py pycparser-release_v2.14_patched/tests/test_c_lexer.py +--- pycparser-release_v2.14/tests/test_c_lexer.py 2015-06-10 05:00:55.000000000 +0200 ++++ pycparser-release_v2.14_patched/tests/test_c_lexer.py 2019-06-10 14:57:24.981643354 +0200 +@@ -403,12 +403,12 @@ + self.assertLexerError("'b\n", ERR_UNMATCHED_QUOTE) + + self.assertLexerError("'jx'", ERR_INVALID_CCONST) +- self.assertLexerError("'\*'", ERR_INVALID_CCONST) ++ self.assertLexerError(r"'\*'", ERR_INVALID_CCONST) + + def test_string_literals(self): +- self.assertLexerError('"jx\9"', ERR_STRING_ESCAPE) +- self.assertLexerError('"hekllo\* on ix"', ERR_STRING_ESCAPE) +- self.assertLexerError('L"hekllo\* on ix"', ERR_STRING_ESCAPE) ++ self.assertLexerError(r'"jx\9"', ERR_STRING_ESCAPE) ++ self.assertLexerError(r'"hekllo\* on ix"', ERR_STRING_ESCAPE) ++ self.assertLexerError(r'L"hekllo\* on ix"', ERR_STRING_ESCAPE) + + def test_preprocessor(self): + self.assertLexerError('#line "ka"', ERR_FILENAME_BEFORE_LINE) +diff -ru pycparser-release_v2.14/tests/test_c_parser.py pycparser-release_v2.14_patched/tests/test_c_parser.py +--- pycparser-release_v2.14/tests/test_c_parser.py 2015-06-10 05:00:55.000000000 +0200 ++++ pycparser-release_v2.14_patched/tests/test_c_parser.py 2019-06-10 14:58:40.725330566 +0200 +@@ -1637,7 +1637,7 @@ + + self.assertTrue(isinstance(p.ext[0], Typedef)) + self.assertEqual(p.ext[0].coord.line, 213) +- self.assertEqual(p.ext[0].coord.file, "D:\eli\cpp_stuff\libc_include/stddef.h") ++ self.assertEqual(p.ext[0].coord.file, r"D:\eli\cpp_stuff\libc_include/stddef.h") + + self.assertTrue(isinstance(p.ext[-1], FuncDef)) + self.assertEqual(p.ext[-1].coord.line, 15)