Bug 1907474 - python-mako fails to build with Python 3.10: ImportWarning: VendorImporter.exec_module() not found; falling back to load_module()
Summary: python-mako fails to build with Python 3.10: ImportWarning: VendorImporter.ex...
Keywords:
Status: ASSIGNED
Alias: None
Product: Fedora
Classification: Fedora
Component: python-mako
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Igor Raits
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1916437
Blocks: PYTHON3.10
TreeView+ depends on / blocked
 
Reported: 2020-12-14 15:11 UTC by Tomáš Hrnčiar
Modified: 2021-02-09 16:24 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github sqlalchemy mako pull 328 0 None closed Avoid warnings under Python 3.10 2021-01-18 07:54:41 UTC

Description Tomáš Hrnčiar 2020-12-14 15:11:33 UTC
python-mako fails to build with Python 3.10.0a3.

=================================== FAILURES ===================================
_______________ ExceptionsTest.test_tback_no_trace_from_py_file ________________
Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_3/test/test_exceptions.py", line 369, in test_tback_no_trace_from_py_file
    assert (
AssertionError: assert 'local variable &#39;y&#39; referenced before assignment' in '\n\n\n<html>\n<head>\n    <title>Mako Runtime Error</title>\n    <style>\n        body { font-family:verdana; margin:...for removal in Python 3.12; use exec_module() instead</h3>\n\n\n<div class="stacktrace">\n</div>\n\n</body>\n</html>\n'
_________________ ExceptionsTest.test_tback_trace_from_py_file _________________
Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_3/test/test_exceptions.py", line 375, in test_tback_trace_from_py_file
    t = self._file_template("runtimeerr.html")
  File "/builddir/build/BUILD/mako-rel_1_1_3/test/__init__.py", line 20, in _file_template
    return Template(
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/template.py", line 348, in __init__
    module = self._compile_from_file(path, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/template.py", line 416, in _compile_from_file
    module = compat.load_module(self.module_id, path)
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/compat.py", line 105, in load_module
    return machinery.SourceFileLoader(module_id, path).load_module()
  File "<frozen importlib._bootstrap_external>", line 508, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 1012, in load_module
  File "<frozen importlib._bootstrap_external>", line 837, in load_module
  File "<frozen importlib._bootstrap>", line 283, in _load_module_shim
DeprecationWarning: the load_module() method is deprecated and slated for removal in Python 3.12; use exec_module() instead
________________________ EncodingTest.test_unicode_bom _________________________
Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_3/test/test_template.py", line 152, in test_unicode_bom
    self._do_file_test(
  File "/builddir/build/BUILD/mako-rel_1_1_3/test/__init__.py", line 43, in _do_file_test
    t1 = self._file_template(filename, **kw)
  File "/builddir/build/BUILD/mako-rel_1_1_3/test/__init__.py", line 20, in _file_template
    return Template(
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/template.py", line 348, in __init__
    module = self._compile_from_file(path, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/template.py", line 416, in _compile_from_file
    module = compat.load_module(self.module_id, path)
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/compat.py", line 105, in load_module
    return machinery.SourceFileLoader(module_id, path).load_module()
  File "<frozen importlib._bootstrap_external>", line 508, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 1012, in load_module
  File "<frozen importlib._bootstrap_external>", line 837, in load_module
  File "<frozen importlib._bootstrap>", line 283, in _load_module_shim
DeprecationWarning: the load_module() method is deprecated and slated for removal in Python 3.12; use exec_module() instead
________________________ EncodingTest.test_unicode_file ________________________
Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_3/test/test_template.py", line 120, in test_unicode_file
    self._do_file_test(
  File "/builddir/build/BUILD/mako-rel_1_1_3/test/__init__.py", line 43, in _do_file_test
    t1 = self._file_template(filename, **kw)
  File "/builddir/build/BUILD/mako-rel_1_1_3/test/__init__.py", line 20, in _file_template
    return Template(
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/template.py", line 348, in __init__
    module = self._compile_from_file(path, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/template.py", line 416, in _compile_from_file
    module = compat.load_module(self.module_id, path)
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/compat.py", line 105, in load_module
    return machinery.SourceFileLoader(module_id, path).load_module()
  File "<frozen importlib._bootstrap_external>", line 508, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 1012, in load_module
  File "<frozen importlib._bootstrap_external>", line 837, in load_module
  File "<frozen importlib._bootstrap>", line 283, in _load_module_shim
DeprecationWarning: the load_module() method is deprecated and slated for removal in Python 3.12; use exec_module() instead
_____________________ EncodingTest.test_unicode_file_code ______________________
Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_3/test/test_template.py", line 130, in test_unicode_file_code
    self._do_file_test(
  File "/builddir/build/BUILD/mako-rel_1_1_3/test/__init__.py", line 43, in _do_file_test
    t1 = self._file_template(filename, **kw)
  File "/builddir/build/BUILD/mako-rel_1_1_3/test/__init__.py", line 20, in _file_template
    return Template(
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/template.py", line 348, in __init__
    module = self._compile_from_file(path, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/template.py", line 416, in _compile_from_file
    module = compat.load_module(self.module_id, path)
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/compat.py", line 105, in load_module
    return machinery.SourceFileLoader(module_id, path).load_module()
  File "<frozen importlib._bootstrap_external>", line 508, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 1012, in load_module
  File "<frozen importlib._bootstrap_external>", line 837, in load_module
  File "<frozen importlib._bootstrap>", line 283, in _load_module_shim
DeprecationWarning: the load_module() method is deprecated and slated for removal in Python 3.12; use exec_module() instead
________________ EncodingTest.test_unicode_literal_in_expr_file ________________
Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_3/test/test_template.py", line 264, in test_unicode_literal_in_expr_file
    self._do_file_test(
  File "/builddir/build/BUILD/mako-rel_1_1_3/test/__init__.py", line 43, in _do_file_test
    t1 = self._file_template(filename, **kw)
  File "/builddir/build/BUILD/mako-rel_1_1_3/test/__init__.py", line 20, in _file_template
    return Template(
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/template.py", line 348, in __init__
    module = self._compile_from_file(path, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/template.py", line 416, in _compile_from_file
    module = compat.load_module(self.module_id, path)
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/compat.py", line 105, in load_module
    return machinery.SourceFileLoader(module_id, path).load_module()
  File "<frozen importlib._bootstrap_external>", line 508, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 1012, in load_module
  File "<frozen importlib._bootstrap_external>", line 837, in load_module
  File "<frozen importlib._bootstrap>", line 283, in _load_module_shim
DeprecationWarning: the load_module() method is deprecated and slated for removal in Python 3.12; use exec_module() instead
___________________ EncodingTest.test_unicode_literal_in_tag ___________________
Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_3/test/test_template.py", line 347, in test_unicode_literal_in_tag
    self._do_file_test(
  File "/builddir/build/BUILD/mako-rel_1_1_3/test/__init__.py", line 43, in _do_file_test
    t1 = self._file_template(filename, **kw)
  File "/builddir/build/BUILD/mako-rel_1_1_3/test/__init__.py", line 20, in _file_template
    return Template(
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/template.py", line 348, in __init__
    module = self._compile_from_file(path, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/template.py", line 416, in _compile_from_file
    module = compat.load_module(self.module_id, path)
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/compat.py", line 105, in load_module
    return machinery.SourceFileLoader(module_id, path).load_module()
  File "<frozen importlib._bootstrap_external>", line 508, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 1012, in load_module
  File "<frozen importlib._bootstrap_external>", line 837, in load_module
  File "<frozen importlib._bootstrap>", line 283, in _load_module_shim
DeprecationWarning: the load_module() method is deprecated and slated for removal in Python 3.12; use exec_module() instead
___________________________ ModuleDirTest.test_basic ___________________________
Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_3/test/test_template.py", line 1425, in test_basic
    t = self._file_template("modtest.html")
  File "/builddir/build/BUILD/mako-rel_1_1_3/test/__init__.py", line 20, in _file_template
    return Template(
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/template.py", line 348, in __init__
    module = self._compile_from_file(path, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/template.py", line 416, in _compile_from_file
    module = compat.load_module(self.module_id, path)
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/compat.py", line 105, in load_module
    return machinery.SourceFileLoader(module_id, path).load_module()
  File "<frozen importlib._bootstrap_external>", line 508, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 1012, in load_module
  File "<frozen importlib._bootstrap_external>", line 837, in load_module
  File "<frozen importlib._bootstrap>", line 283, in _load_module_shim
DeprecationWarning: the load_module() method is deprecated and slated for removal in Python 3.12; use exec_module() instead
_________________________ ModuleDirTest.test_callable __________________________
Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/lookup.py", line 249, in get_template
    return self._check(uri, self._collection[uri])
KeyError: '/modtest.html'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_3/test/test_template.py", line 1444, in test_callable
    t = lookup.get_template("/modtest.html")
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/lookup.py", line 260, in get_template
    return self._load(srcfile, uri)
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/lookup.py", line 322, in _load
    self._collection[uri] = template = Template(
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/template.py", line 348, in __init__
    module = self._compile_from_file(path, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/template.py", line 416, in _compile_from_file
    module = compat.load_module(self.module_id, path)
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/compat.py", line 105, in load_module
    return machinery.SourceFileLoader(module_id, path).load_module()
  File "<frozen importlib._bootstrap_external>", line 508, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 1012, in load_module
  File "<frozen importlib._bootstrap_external>", line 837, in load_module
  File "<frozen importlib._bootstrap>", line 283, in _load_module_shim
DeprecationWarning: the load_module() method is deprecated and slated for removal in Python 3.12; use exec_module() instead
_______________________ ModuleDirTest.test_custom_writer _______________________
Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/lookup.py", line 249, in get_template
    return self._check(uri, self._collection[uri])
KeyError: '/modtest.html'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_3/test/test_template.py", line 1469, in test_custom_writer
    lookup.get_template("/modtest.html")
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/lookup.py", line 260, in get_template
    return self._load(srcfile, uri)
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/lookup.py", line 322, in _load
    self._collection[uri] = template = Template(
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/template.py", line 348, in __init__
    module = self._compile_from_file(path, filename)
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/template.py", line 416, in _compile_from_file
    module = compat.load_module(self.module_id, path)
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/compat.py", line 105, in load_module
    return machinery.SourceFileLoader(module_id, path).load_module()
  File "<frozen importlib._bootstrap_external>", line 508, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 1012, in load_module
  File "<frozen importlib._bootstrap_external>", line 837, in load_module
  File "<frozen importlib._bootstrap>", line 283, in _load_module_shim
DeprecationWarning: the load_module() method is deprecated and slated for removal in Python 3.12; use exec_module() instead
__________________________ UtilTest.test_load_module ___________________________
Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_3/test/test_util.py", line 46, in test_load_module
    module = compat.load_module("mako.template", fn)
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/compat.py", line 105, in load_module
    return machinery.SourceFileLoader(module_id, path).load_module()
  File "<frozen importlib._bootstrap_external>", line 508, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 1012, in load_module
  File "<frozen importlib._bootstrap_external>", line 837, in load_module
  File "<frozen importlib._bootstrap>", line 283, in _load_module_shim
DeprecationWarning: the load_module() method is deprecated and slated for removal in Python 3.12; use exec_module() instead
______________________ UtilTest.test_load_plugin_failure _______________________
Traceback (most recent call last):
  File "/builddir/build/BUILD/mako-rel_1_1_3/test/test_util.py", line 53, in test_load_plugin_failure
    assert_raises_message(
  File "/builddir/build/BUILD/mako-rel_1_1_3/test/__init__.py", line 131, in assert_raises_message
    return callable_(*args, **kwargs)
  File "/builddir/build/BUILD/mako-rel_1_1_3/mako/util.py", line 34, in load
    import pkg_resources
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 73, in <module>
    from pkg_resources.extern import appdirs
  File "<frozen importlib._bootstrap>", line 1026, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1005, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 681, in _load_unlocked
ImportWarning: VendorImporter.exec_module() not found; falling back to load_module()
=========================== short test summary info ============================
FAILED test/test_exceptions.py::ExceptionsTest::test_tback_no_trace_from_py_file
FAILED test/test_exceptions.py::ExceptionsTest::test_tback_trace_from_py_file
FAILED test/test_template.py::EncodingTest::test_unicode_bom - DeprecationWar...
FAILED test/test_template.py::EncodingTest::test_unicode_file - DeprecationWa...
FAILED test/test_template.py::EncodingTest::test_unicode_file_code - Deprecat...
FAILED test/test_template.py::EncodingTest::test_unicode_literal_in_expr_file
FAILED test/test_template.py::EncodingTest::test_unicode_literal_in_tag - Dep...
FAILED test/test_template.py::ModuleDirTest::test_basic - DeprecationWarning:...
FAILED test/test_template.py::ModuleDirTest::test_callable - DeprecationWarni...
FAILED test/test_template.py::ModuleDirTest::test_custom_writer - Deprecation...
FAILED test/test_util.py::UtilTest::test_load_module - DeprecationWarning: th...
FAILED test/test_util.py::UtilTest::test_load_plugin_failure - ImportWarning:...
================== 12 failed, 396 passed, 61 skipped in 4.11s ==================

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.10/fedora-rawhide-x86_64/01827134-python-mako/

For all our attempts to build python-mako with Python 3.10, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/python-mako/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.10:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/

Let us know here if you have any questions.

Python 3.10 will be included in Fedora 35. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.10.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Miro Hrončok 2020-12-15 12:10:37 UTC
Tomáš, isn't this a problem in pkg_resources instead? I see this repeated in several packages.

Comment 2 Petr Viktorin 2021-01-06 17:44:23 UTC
These don't come from setuptools, but from mako.compat.

Comment 3 Miro Hrončok 2021-01-08 12:58:30 UTC
This has pretty severe impact on depndencies:

package gobject-introspection-devel-1.66.1-2.fc34.x86_64 requires python3-mako, but none of the providers can be installed
  - package python3-mako-1.1.3-1.fc33.noarch requires python(abi) = 3.9, but none of the providers can be installed

I'm building mako in Copr with test disabled to workaround that, but this needs to be fixed (at least by not treating warnings as errors).

Comment 4 Petr Viktorin 2021-01-13 14:31:37 UTC
I sent a PR upstream and will prepare one for dist-git.

Comment 6 Ben Cotton 2021-02-09 16:12:38 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 34 development cycle.
Changing version to 34.


Note You need to log in before you can comment on or make changes to this bug.