Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.9: DeprecationWarning: The parser module is deprecated, tests fail #310

Closed
hroncok opened this issue Jan 5, 2020 · 5 comments · Fixed by python-babel/babel#684
Labels
bug Something isn't working py3k

Comments

@hroncok
Copy link
Contributor

hroncok commented Jan 5, 2020

Hello. In Fedora, we are trying to build packages with Python 3.9.0a2. mako 1.1.0 tests fail with:

=================================== FAILURES ===================================
_________________________ CmdTest.test_file_syntax_err _________________________
Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/cmd.py", line 73, in cmdline
    template = Template(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 348, in __init__
    module = self._compile_from_file(path, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 430, in _compile_from_file
    code, module = _compile_text(self, data, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 733, in _compile_text
    source, lexer = _compile(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 712, in _compile
    node = lexer.parse()
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 262, in parse
    if self.match_expression():
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 427, in match_expression
    text, end = self.parse_until_text(True, r"\|", r"}")
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 143, in parse_until_text
    raise exceptions.SyntaxException(
mako.exceptions.SyntaxException: Expected: \|,} in file '/builddir/build/BUILD/mako-rel_1_1_0/test/templates/cmd_syntax.mako' at line: 1 char: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_cmd.py", line 65, in test_file_syntax_err
    cmdline(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/cmd.py", line 79, in cmdline
    _exit()
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/cmd.py", line 23, in _exit
    sys.stderr.write(exceptions.text_error_template().render())
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 476, in render
    return runtime._render(self, self.callable_, args, data)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/runtime.py", line 878, in _render
    _render_context(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/runtime.py", line 920, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/runtime.py", line 947, in _exec_template
    callable_(context, *args, **kwargs)
  File "memory:0x7f3ea3552820", line 27, in render_body
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 93, in __init__
    self.records = self._init(traceback)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 242, in _init
    encoding = util.parse_encoding(fp)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/util.py", line 260, in parse_encoding
    import parser
DeprecationWarning: The parser module is deprecated and will be removed in future versions of Python
________________________ CmdTest.test_stdin_syntax_err _________________________
Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/cmd.py", line 59, in cmdline
    template = Template(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 331, in __init__
    (code, module) = _compile_text(self, text, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 733, in _compile_text
    source, lexer = _compile(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 712, in _compile
    node = lexer.parse()
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 262, in parse
    if self.match_expression():
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 427, in match_expression
    text, end = self.parse_until_text(True, r"\|", r"}")
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 143, in parse_until_text
    raise exceptions.SyntaxException(
mako.exceptions.SyntaxException: Expected: \|,} at line: 1 char: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_cmd.py", line 36, in test_stdin_syntax_err
    cmdline(["--var", "x=5", "-"])
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/cmd.py", line 65, in cmdline
    _exit()
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/cmd.py", line 23, in _exit
    sys.stderr.write(exceptions.text_error_template().render())
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 476, in render
    return runtime._render(self, self.callable_, args, data)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/runtime.py", line 878, in _render
    _render_context(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/runtime.py", line 920, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/runtime.py", line 947, in _exec_template
    callable_(context, *args, **kwargs)
  File "memory:0x7f3ea356ed60", line 27, in render_body
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 93, in __init__
    self.records = self._init(traceback)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 242, in _init
    encoding = util.parse_encoding(fp)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/util.py", line 260, in parse_encoding
    import parser
DeprecationWarning: The parser module is deprecated and will be removed in future versions of Python
___________________ ExceptionsTest.test_html_error_template ____________________
Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_exceptions.py", line 22, in test_html_error_template
    template = Template(code)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 331, in __init__
    (code, module) = _compile_text(self, text, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 733, in _compile_text
    source, lexer = _compile(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 712, in _compile
    node = lexer.parse()
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 264, in parse
    if self.match_control_line():
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 476, in match_control_line
    self.append_node(parsetree.ControlLine, keyword, isend, text)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 152, in append_node
    node = nodecls(*args, **kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/parsetree.py", line 93, in __init__
    code = ast.PythonFragment(text, **self.exception_kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/ast.py", line 89, in __init__
    raise exceptions.CompileException(
mako.exceptions.CompileException: Fragment 'i = 0' is not a partial control statement at line: 2 char: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_exceptions.py", line 26, in test_html_error_template
    html_error = exceptions.html_error_template().render_unicode()
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 481, in render_unicode
    return runtime._render(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/runtime.py", line 878, in _render
    _render_context(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/runtime.py", line 920, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/runtime.py", line 947, in _exec_template
    callable_(context, *args, **kwargs)
  File "memory:0x7f3ea356e2e0", line 45, in render_body
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 93, in __init__
    self.records = self._init(traceback)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 242, in _init
    encoding = util.parse_encoding(fp)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/util.py", line 260, in parse_encoding
    import parser
DeprecationWarning: The parser module is deprecated and will be removed in future versions of Python
_____________________ ExceptionsTest.test_mod_no_encoding ______________________
Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lookup.py", line 249, in get_template
    return self._check(uri, self._collection[uri])
KeyError: 'not_found.html'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_exceptions.py", line 326, in test_mod_no_encoding
    mod.run()
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/foo/mod_no_encoding.py", line 7, in run
    tpl = template_lookup.get_template("not_found.html")
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lookup.py", line 262, in get_template
    raise exceptions.TopLevelLookupException(
mako.exceptions.TopLevelLookupException: Cant locate template for uri 'not_found.html'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_exceptions.py", line 329, in test_mod_no_encoding
    exceptions.html_error_template().render_unicode(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 481, in render_unicode
    return runtime._render(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/runtime.py", line 878, in _render
    _render_context(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/runtime.py", line 920, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/runtime.py", line 947, in _exec_template
    callable_(context, *args, **kwargs)
  File "memory:0x7f3ea3611ac0", line 45, in render_body
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 93, in __init__
    self.records = self._init(traceback)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 242, in _init
    encoding = util.parse_encoding(fp)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/util.py", line 260, in parse_encoding
    import parser
DeprecationWarning: The parser module is deprecated and will be removed in future versions of Python
___________________ ExceptionsTest.test_text_error_template ____________________
Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_exceptions.py", line 55, in test_text_error_template
    template = Template(code)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 331, in __init__
    (code, module) = _compile_text(self, text, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 733, in _compile_text
    source, lexer = _compile(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 712, in _compile
    node = lexer.parse()
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 264, in parse
    if self.match_control_line():
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 476, in match_control_line
    self.append_node(parsetree.ControlLine, keyword, isend, text)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 152, in append_node
    node = nodecls(*args, **kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/parsetree.py", line 93, in __init__
    code = ast.PythonFragment(text, **self.exception_kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/ast.py", line 89, in __init__
    raise exceptions.CompileException(
mako.exceptions.CompileException: Fragment 'i = 0' is not a partial control statement at line: 2 char: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_exceptions.py", line 59, in test_text_error_template
    text_error = exceptions.text_error_template().render_unicode()
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 481, in render_unicode
    return runtime._render(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/runtime.py", line 878, in _render
    _render_context(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/runtime.py", line 920, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/runtime.py", line 947, in _exec_template
    callable_(context, *args, **kwargs)
  File "memory:0x7f3ea3420370", line 27, in render_body
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 93, in __init__
    self.records = self._init(traceback)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 242, in _init
    encoding = util.parse_encoding(fp)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/util.py", line 260, in parse_encoding
    import parser
DeprecationWarning: The parser module is deprecated and will be removed in future versions of Python
___________ ExceptionsTest.test_utf8_html_error_template_no_pygments ___________
Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_exceptions.py", line 142, in test_utf8_html_error_template_no_pygments
    template = Template(code)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 331, in __init__
    (code, module) = _compile_text(self, text, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 733, in _compile_text
    source, lexer = _compile(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 712, in _compile
    node = lexer.parse()
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 264, in parse
    if self.match_control_line():
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 476, in match_control_line
    self.append_node(parsetree.ControlLine, keyword, isend, text)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 152, in append_node
    node = nodecls(*args, **kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/parsetree.py", line 93, in __init__
    code = ast.PythonFragment(text, **self.exception_kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/ast.py", line 89, in __init__
    raise exceptions.CompileException(
mako.exceptions.CompileException: Fragment 'if 2 == 2: /an error' is not a partial control statement at line: 2 char: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_exceptions.py", line 145, in test_utf8_html_error_template_no_pygments
    html_error = exceptions.html_error_template().render()
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 476, in render
    return runtime._render(self, self.callable_, args, data)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/runtime.py", line 878, in _render
    _render_context(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/runtime.py", line 920, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/runtime.py", line 947, in _exec_template
    callable_(context, *args, **kwargs)
  File "memory:0x7f3ea355d8b0", line 45, in render_body
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 93, in __init__
    self.records = self._init(traceback)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 242, in _init
    encoding = util.parse_encoding(fp)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/util.py", line 260, in parse_encoding
    import parser
DeprecationWarning: The parser module is deprecated and will be removed in future versions of Python
_________________ RichTracebackTest.test_unicode_file_runtime __________________
Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/pyparser.py", line 45, in parse
    return _ast_util.parse(code, "<unknown>", mode)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/_ast_util.py", line 92, in parse
    return compile(expr, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 1
    print 'Alors vous imaginez ma surprise, au lever du jour, quand une drôle de petite voix m’a réveillé. Elle disait: « S’il vous plaît… dessine-moi un mouton! »' + int(5/0)
          ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_template.py", line 1391, in _do_test_traceback
    template = Template(**templateargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 348, in __init__
    module = self._compile_from_file(path, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 430, in _compile_from_file
    code, module = _compile_text(self, data, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 733, in _compile_text
    source, lexer = _compile(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 712, in _compile
    node = lexer.parse()
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 272, in parse
    if self.match_python_block():
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 412, in match_python_block
    self.append_node(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 152, in append_node
    node = nodecls(*args, **kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/parsetree.py", line 159, in __init__
    self.code = ast.PythonCode(text, **self.exception_kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/ast.py", line 43, in __init__
    expr = pyparser.parse(code.lstrip(), "exec", **exception_kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/pyparser.py", line 47, in parse
    raise exceptions.SyntaxException(
mako.exceptions.SyntaxException: (SyntaxError) invalid syntax (<unknown>, line 1) ("print 'Alors vous imaginez ma surprise, au lever d") in file '/builddir/build/BUILD/mako-rel_1_1_0/test/templates/unicode_runtime_error.html' at line: 2 char: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_template.py", line 1408, in _do_test
    self._do_test_traceback(utf8, memory, syntax)
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_template.py", line 1396, in _do_test_traceback
    tback = exceptions.RichTraceback()
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 93, in __init__
    self.records = self._init(traceback)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 242, in _init
    encoding = util.parse_encoding(fp)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/util.py", line 260, in parse_encoding
    import parser
DeprecationWarning: The parser module is deprecated and will be removed in future versions of Python
__________________ RichTracebackTest.test_unicode_file_syntax __________________
Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/pyparser.py", line 45, in parse
    return _ast_util.parse(code, "<unknown>", mode)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/_ast_util.py", line 92, in parse
    return compile(expr, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 1
    print 'Alors vous imaginez ma surprise, au lever du jour, quand une drôle de petite voix m’a réveillé. Elle disait: « S’il vous plaît… dessine-moi un mouton! »' + int(5/0)
          ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_template.py", line 1391, in _do_test_traceback
    template = Template(**templateargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 348, in __init__
    module = self._compile_from_file(path, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 430, in _compile_from_file
    code, module = _compile_text(self, data, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 733, in _compile_text
    source, lexer = _compile(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 712, in _compile
    node = lexer.parse()
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 272, in parse
    if self.match_python_block():
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 412, in match_python_block
    self.append_node(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 152, in append_node
    node = nodecls(*args, **kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/parsetree.py", line 159, in __init__
    self.code = ast.PythonCode(text, **self.exception_kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/ast.py", line 43, in __init__
    expr = pyparser.parse(code.lstrip(), "exec", **exception_kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/pyparser.py", line 47, in parse
    raise exceptions.SyntaxException(
mako.exceptions.SyntaxException: (SyntaxError) invalid syntax (<unknown>, line 1) ("print 'Alors vous imaginez ma surprise, au lever d") in file '/builddir/build/BUILD/mako-rel_1_1_0/test/templates/unicode_runtime_error.html' at line: 2 char: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_template.py", line 1408, in _do_test
    self._do_test_traceback(utf8, memory, syntax)
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_template.py", line 1396, in _do_test_traceback
    tback = exceptions.RichTraceback()
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 93, in __init__
    self.records = self._init(traceback)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 242, in _init
    encoding = util.parse_encoding(fp)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/util.py", line 260, in parse_encoding
    import parser
DeprecationWarning: The parser module is deprecated and will be removed in future versions of Python
________________ RichTracebackTest.test_unicode_memory_runtime _________________
Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/pyparser.py", line 45, in parse
    return _ast_util.parse(code, "<unknown>", mode)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/_ast_util.py", line 92, in parse
    return compile(expr, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 1
    print 'Alors vous imaginez ma surprise, au lever du jour, quand une drôle de petite voix m’a réveillé. Elle disait: « S’il vous plaît… dessine-moi un mouton! »' + int(5/0)
          ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_template.py", line 1391, in _do_test_traceback
    template = Template(**templateargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 348, in __init__
    module = self._compile_from_file(path, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 430, in _compile_from_file
    code, module = _compile_text(self, data, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 733, in _compile_text
    source, lexer = _compile(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 712, in _compile
    node = lexer.parse()
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 272, in parse
    if self.match_python_block():
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 412, in match_python_block
    self.append_node(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 152, in append_node
    node = nodecls(*args, **kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/parsetree.py", line 159, in __init__
    self.code = ast.PythonCode(text, **self.exception_kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/ast.py", line 43, in __init__
    expr = pyparser.parse(code.lstrip(), "exec", **exception_kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/pyparser.py", line 47, in parse
    raise exceptions.SyntaxException(
mako.exceptions.SyntaxException: (SyntaxError) invalid syntax (<unknown>, line 1) ("print 'Alors vous imaginez ma surprise, au lever d") in file '/builddir/build/BUILD/mako-rel_1_1_0/test/templates/unicode_runtime_error.html' at line: 2 char: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_template.py", line 1408, in _do_test
    self._do_test_traceback(utf8, memory, syntax)
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_template.py", line 1396, in _do_test_traceback
    tback = exceptions.RichTraceback()
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 93, in __init__
    self.records = self._init(traceback)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 242, in _init
    encoding = util.parse_encoding(fp)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/util.py", line 260, in parse_encoding
    import parser
DeprecationWarning: The parser module is deprecated and will be removed in future versions of Python
_________________ RichTracebackTest.test_unicode_memory_syntax _________________
Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/pyparser.py", line 45, in parse
    return _ast_util.parse(code, "<unknown>", mode)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/_ast_util.py", line 92, in parse
    return compile(expr, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 1
    print 'Alors vous imaginez ma surprise, au lever du jour, quand une drôle de petite voix m’a réveillé. Elle disait: « S’il vous plaît… dessine-moi un mouton! »' + int(5/0)
          ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_template.py", line 1391, in _do_test_traceback
    template = Template(**templateargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 348, in __init__
    module = self._compile_from_file(path, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 430, in _compile_from_file
    code, module = _compile_text(self, data, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 733, in _compile_text
    source, lexer = _compile(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 712, in _compile
    node = lexer.parse()
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 272, in parse
    if self.match_python_block():
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 412, in match_python_block
    self.append_node(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 152, in append_node
    node = nodecls(*args, **kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/parsetree.py", line 159, in __init__
    self.code = ast.PythonCode(text, **self.exception_kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/ast.py", line 43, in __init__
    expr = pyparser.parse(code.lstrip(), "exec", **exception_kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/pyparser.py", line 47, in parse
    raise exceptions.SyntaxException(
mako.exceptions.SyntaxException: (SyntaxError) invalid syntax (<unknown>, line 1) ("print 'Alors vous imaginez ma surprise, au lever d") in file '/builddir/build/BUILD/mako-rel_1_1_0/test/templates/unicode_runtime_error.html' at line: 2 char: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_template.py", line 1408, in _do_test
    self._do_test_traceback(utf8, memory, syntax)
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_template.py", line 1396, in _do_test_traceback
    tback = exceptions.RichTraceback()
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 93, in __init__
    self.records = self._init(traceback)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 242, in _init
    encoding = util.parse_encoding(fp)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/util.py", line 260, in parse_encoding
    import parser
DeprecationWarning: The parser module is deprecated and will be removed in future versions of Python
___________________ RichTracebackTest.test_utf8_file_runtime ___________________
Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/pyparser.py", line 45, in parse
    return _ast_util.parse(code, "<unknown>", mode)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/_ast_util.py", line 92, in parse
    return compile(expr, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 1
    print 'Alors vous imaginez ma surprise, au lever du jour, quand une drôle de petite voix m’a réveillé. Elle disait: « S’il vous plaît… dessine-moi un mouton! »' + int(5/0)
          ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_template.py", line 1391, in _do_test_traceback
    template = Template(**templateargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 348, in __init__
    module = self._compile_from_file(path, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 430, in _compile_from_file
    code, module = _compile_text(self, data, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 733, in _compile_text
    source, lexer = _compile(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 712, in _compile
    node = lexer.parse()
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 272, in parse
    if self.match_python_block():
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 412, in match_python_block
    self.append_node(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 152, in append_node
    node = nodecls(*args, **kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/parsetree.py", line 159, in __init__
    self.code = ast.PythonCode(text, **self.exception_kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/ast.py", line 43, in __init__
    expr = pyparser.parse(code.lstrip(), "exec", **exception_kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/pyparser.py", line 47, in parse
    raise exceptions.SyntaxException(
mako.exceptions.SyntaxException: (SyntaxError) invalid syntax (<unknown>, line 1) ("print 'Alors vous imaginez ma surprise, au lever d") in file '/builddir/build/BUILD/mako-rel_1_1_0/test/templates/unicode_runtime_error.html' at line: 2 char: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_template.py", line 1408, in _do_test
    self._do_test_traceback(utf8, memory, syntax)
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_template.py", line 1396, in _do_test_traceback
    tback = exceptions.RichTraceback()
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 93, in __init__
    self.records = self._init(traceback)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 242, in _init
    encoding = util.parse_encoding(fp)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/util.py", line 260, in parse_encoding
    import parser
DeprecationWarning: The parser module is deprecated and will be removed in future versions of Python
___________________ RichTracebackTest.test_utf8_file_syntax ____________________
Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/pyparser.py", line 45, in parse
    return _ast_util.parse(code, "<unknown>", mode)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/_ast_util.py", line 92, in parse
    return compile(expr, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 1
    print 'Alors vous imaginez ma surprise, au lever du jour, quand une drôle de petite voix m’a réveillé. Elle disait: « S’il vous plaît… dessine-moi un mouton! »' + int(5/0)
          ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_template.py", line 1391, in _do_test_traceback
    template = Template(**templateargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 348, in __init__
    module = self._compile_from_file(path, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 430, in _compile_from_file
    code, module = _compile_text(self, data, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 733, in _compile_text
    source, lexer = _compile(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 712, in _compile
    node = lexer.parse()
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 272, in parse
    if self.match_python_block():
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 412, in match_python_block
    self.append_node(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 152, in append_node
    node = nodecls(*args, **kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/parsetree.py", line 159, in __init__
    self.code = ast.PythonCode(text, **self.exception_kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/ast.py", line 43, in __init__
    expr = pyparser.parse(code.lstrip(), "exec", **exception_kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/pyparser.py", line 47, in parse
    raise exceptions.SyntaxException(
mako.exceptions.SyntaxException: (SyntaxError) invalid syntax (<unknown>, line 1) ("print 'Alors vous imaginez ma surprise, au lever d") in file '/builddir/build/BUILD/mako-rel_1_1_0/test/templates/unicode_runtime_error.html' at line: 2 char: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_template.py", line 1408, in _do_test
    self._do_test_traceback(utf8, memory, syntax)
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_template.py", line 1396, in _do_test_traceback
    tback = exceptions.RichTraceback()
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 93, in __init__
    self.records = self._init(traceback)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 242, in _init
    encoding = util.parse_encoding(fp)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/util.py", line 260, in parse_encoding
    import parser
DeprecationWarning: The parser module is deprecated and will be removed in future versions of Python
__________________ RichTracebackTest.test_utf8_memory_runtime __________________
Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/pyparser.py", line 45, in parse
    return _ast_util.parse(code, "<unknown>", mode)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/_ast_util.py", line 92, in parse
    return compile(expr, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 1
    print 'Alors vous imaginez ma surprise, au lever du jour, quand une drôle de petite voix m’a réveillé. Elle disait: « S’il vous plaît… dessine-moi un mouton! »' + int(5/0)
          ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_template.py", line 1391, in _do_test_traceback
    template = Template(**templateargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 348, in __init__
    module = self._compile_from_file(path, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 430, in _compile_from_file
    code, module = _compile_text(self, data, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 733, in _compile_text
    source, lexer = _compile(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 712, in _compile
    node = lexer.parse()
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 272, in parse
    if self.match_python_block():
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 412, in match_python_block
    self.append_node(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 152, in append_node
    node = nodecls(*args, **kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/parsetree.py", line 159, in __init__
    self.code = ast.PythonCode(text, **self.exception_kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/ast.py", line 43, in __init__
    expr = pyparser.parse(code.lstrip(), "exec", **exception_kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/pyparser.py", line 47, in parse
    raise exceptions.SyntaxException(
mako.exceptions.SyntaxException: (SyntaxError) invalid syntax (<unknown>, line 1) ("print 'Alors vous imaginez ma surprise, au lever d") in file '/builddir/build/BUILD/mako-rel_1_1_0/test/templates/unicode_runtime_error.html' at line: 2 char: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_template.py", line 1408, in _do_test
    self._do_test_traceback(utf8, memory, syntax)
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_template.py", line 1396, in _do_test_traceback
    tback = exceptions.RichTraceback()
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 93, in __init__
    self.records = self._init(traceback)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 242, in _init
    encoding = util.parse_encoding(fp)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/util.py", line 260, in parse_encoding
    import parser
DeprecationWarning: The parser module is deprecated and will be removed in future versions of Python
__________________ RichTracebackTest.test_utf8_memory_syntax ___________________
Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/pyparser.py", line 45, in parse
    return _ast_util.parse(code, "<unknown>", mode)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/_ast_util.py", line 92, in parse
    return compile(expr, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 1
    print 'Alors vous imaginez ma surprise, au lever du jour, quand une drôle de petite voix m’a réveillé. Elle disait: « S’il vous plaît… dessine-moi un mouton! »' + int(5/0)
          ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_template.py", line 1391, in _do_test_traceback
    template = Template(**templateargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 348, in __init__
    module = self._compile_from_file(path, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 430, in _compile_from_file
    code, module = _compile_text(self, data, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 733, in _compile_text
    source, lexer = _compile(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/template.py", line 712, in _compile
    node = lexer.parse()
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 272, in parse
    if self.match_python_block():
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 412, in match_python_block
    self.append_node(
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/lexer.py", line 152, in append_node
    node = nodecls(*args, **kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/parsetree.py", line 159, in __init__
    self.code = ast.PythonCode(text, **self.exception_kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/ast.py", line 43, in __init__
    expr = pyparser.parse(code.lstrip(), "exec", **exception_kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/pyparser.py", line 47, in parse
    raise exceptions.SyntaxException(
mako.exceptions.SyntaxException: (SyntaxError) invalid syntax (<unknown>, line 1) ("print 'Alors vous imaginez ma surprise, au lever d") in file '/builddir/build/BUILD/mako-rel_1_1_0/test/templates/unicode_runtime_error.html' at line: 2 char: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_template.py", line 1408, in _do_test
    self._do_test_traceback(utf8, memory, syntax)
  File "/builddir/build/BUILD/mako-rel_1_1_0/test/test_template.py", line 1396, in _do_test_traceback
    tback = exceptions.RichTraceback()
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 93, in __init__
    self.records = self._init(traceback)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/exceptions.py", line 242, in _init
    encoding = util.parse_encoding(fp)
  File "/builddir/build/BUILD/mako-rel_1_1_0/mako/util.py", line 260, in parse_encoding
    import parser
DeprecationWarning: The parser module is deprecated and will be removed in future versions of Python
hroncok added a commit to hroncok/mako that referenced this issue Jan 5, 2020
The parser module is deprecated on Python 3.9

Fixes sqlalchemy#310

The same change needs to be done in babel
hroncok added a commit to hroncok/babel that referenced this issue Jan 5, 2020
The parser module is deprecated on Python 3.9

Fixes sqlalchemy/mako#310
See also sqlalchemy/mako#311
@zzzeek zzzeek added bug Something isn't working py3k labels Jan 6, 2020
@zzzeek
Copy link
Member

zzzeek commented Jan 6, 2020

OK so for fedora packaging you can add a patch to your specfile for now, correct ? can you link me to the redhat BZ ?

@sqla-tester
Copy link
Collaborator

Mike Bayer has proposed a fix for this issue in the master branch:

Replace usage of parser.suite with ast.parse https://gerrit.sqlalchemy.org/1654

@zzzeek
Copy link
Member

zzzeek commented Jan 6, 2020

if you want to give the thumbs up on that I can release tomorrow or something

@hroncok
Copy link
Contributor Author

hroncok commented Jan 6, 2020

https://bugzilla.redhat.com/show_bug.cgi?id=1787962

Patching is fine, no need for a quick release.

I had an idea that the tests failed on 2.7 without the ImportError, but there might have been a typo or something like that.

hroncok added a commit to hroncok/babel that referenced this issue Jan 6, 2020
Replaced usage of the long-superseded "parser.suite" module in the
mako.util package for parsing the python magic encoding comment with the
"ast.parse" function introduced many years ago in Python 2.5, as
"parser.suite" is emitting deprecation warnings in Python 3.9.

Fixes sqlalchemy/mako#310
See also sqlalchemy/mako@2dae7d2
akx pushed a commit to python-babel/babel that referenced this issue Jan 6, 2020
Replaced usage of the long-superseded "parser.suite" module in the
mako.util package for parsing the python magic encoding comment with the
"ast.parse" function introduced many years ago in Python 2.5, as
"parser.suite" is emitting deprecation warnings in Python 3.9.

Fixes sqlalchemy/mako#310
See also sqlalchemy/mako@2dae7d2
@zzzeek
Copy link
Member

zzzeek commented Jan 20, 2020

OK that is released on pypi in 1.1.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working py3k
Projects
None yet
3 participants