Skip to content

Multiple pyperformance tests are incompatible with Python 3.9 #74

Closed

Description

@TravisLazar

Changes in Python 3.9 break html5lib, django_template, and tornado_http tests with this error:

File "/usr/local/src/pyperf-tot-no-venv/lib/python3.9/site-packages/html5lib/_tokenizer.py", line 16, in <module> from ._trie import Trie File "/usr/local/src/pyperf-tot-no-venv/lib/python3.9/site-packages/html5lib/_trie/__init__.py", line 3, in <module> from .py import Trie as PyTrie File "/usr/local/src/pyperf-tot-no-venv/lib/python3.9/site-packages/html5lib/_trie/py.py", line 6, in <module> from ._base import Trie as ABCTrie File "/usr/local/src/pyperf-tot-no-venv/lib/python3.9/site-packages/html5lib/_trie/_base.py", line 3, in <module> from collections import Mapping ImportError: cannot import name 'Mapping' from 'collections' (/root/py3-tot-no/lib/python3.9/collections/__init__.py) ERROR: Benchmark html5lib failed: Benchmark died

How to reproduce the issue

I've been building Python 3 from source and encountered it through the standard build process.

  1. Build Python from source. I produced with git commit befa032d8869e0fab4732d910f3887642879d644 from cpython GitHub.

  2. Run pyperformance with one of the following parameter sets:

/py3buildpath/bin/pyperformance run --python=/py3buildpath/bin/python3 --venv venvpath -b html5lib -o output.json

/py3buildpath/bin/pyperformance run --python=/py3buildpath/bin/python3 --venv venvpath -b django_template -o output.json

/py3buildpath/bin/pyperformance run --python=/py3buildpath/bin/python3 --venv venvpath -b tornado_http -o output.json

  1. Error message is shown.

What you expected to happen

I expected these pyperformance benchmark to complete successfully and produce a result (without error).

What actually happens

Benchmark dies trying to import from collections.

I believe with Python 3.9 these packages need to be directly imported from collections.abc.

See this commit: python/cpython@ef092fe

Here's a patch that was backported to the Python 3 vendored library: pypa/pip@ef7ca14#diff-2496ad1eedee846e323ed2916d6c2d24

This library probably needs an official release so that the vendored patch set in Python 3 doesn't become bloated.

Activity

  1. TravisLazar commented on Nov 13, 2019

    @TravisLazar
    Author

    Looks like these issues are in the imported libraries themselves. The only thing pyperformance could do is disable the tests in the benchmarks/init.py. I'll file additional issues in the django_template and tornado_http repositories.

    I believe a patch was already submitted to html5lib: html5lib/html5lib-python@4f92357

  2. TravisLazar commented on Nov 13, 2019

    @TravisLazar
    Author

    I cannot reproduce on django_template or tornado_http anymore. It's possible that I got some logs crossed.

    The html5lib issue still remains.

  3. lazka commented on Nov 13, 2019

    @lazka
    Collaborator

    note that html5lib is disabled on master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions