[New-bugs-announce] [issue44459] 3.10b2 -> 3.10b3 regression in importlib.metadata for rinoh

Anthony Sottile report at bugs.python.org
Sat Jun 19 02:22:26 EDT 2021


New submission from Anthony Sottile <asottile at umich.edu>:

installed from git:

```
$ git remote -v
origin	https://github.com/brechtm/rinohtype.git (fetch)
origin	https://github.com/brechtm/rinohtype.git (push)
$ git rev-parse HEAD
4054539bae53eaddd10291c8429a1a32aeeb4786
```

working in 3.10 b2:

```console
$ ./venv310/bin/python --version --version
Python 3.10.0b2 (default, Jun  2 2021, 00:22:18) [GCC 9.3.0]
$ ./venv310/bin/python -m rinoh
usage: rinoh [-h] [-f FORMAT] [-o OPTION=VALUE] [-t NAME or FILENAME] [-s NAME or FILENAME]
             [-O FILENAME or DIRECTORY] [-p PAPER] [-i] [--list-templates] [--list-stylesheets]
             [--list-fonts [FILENAME]] [--list-formats] [--list-options FRONTEND] [--version] [--docs]
             [input]

Render a structured document to PDF.

positional arguments:
  input                 the document to render

options:
  -h, --help            show this help message and exit
  -f FORMAT, --format FORMAT
                        the format of the input file (default: autodetect)
  -o OPTION=VALUE, --option OPTION=VALUE
                        options to be passed to the input file reader
  -t NAME or FILENAME, --template NAME or FILENAME
                        the document template or template configuration file to use (default: article)
  -s NAME or FILENAME, --stylesheet NAME or FILENAME
                        the style sheet used to style the document elements (default: the template's default)
  -O FILENAME or DIRECTORY, --output FILENAME or DIRECTORY
                        write the PDF output to FILENAME or to an existing DIRECTORY with a filename derived
                        from the input filename (default: the current working directory)
  -p PAPER, --paper PAPER
                        the paper size to render to (default: the template's default)
  -i, --install-resources
                        automatically install missing resources (fonts, templates, style sheets) from PyPI
  --list-templates      list the installed document templates and exit
  --list-stylesheets    list the installed style sheets and exit
  --list-fonts [FILENAME]
                        list the installed fonts or, if FILENAME is given, write a PDF file displaying all
                        the fonts
  --list-formats        list the supported input formats and exit
  --list-options FRONTEND
                        list the options supported by the given frontend and exit
  --version             show program's version number and exit
  --docs                open the online documentation in the default browser
```

broken in 3.10 b3:

```console
$ ./venv/bin/python --version --version
Python 3.10.0b3+ (heads/3.10:1b4addf3cb, Jun 18 2021, 17:21:48) [GCC 9.3.0]
$ ./venv/bin/python -m rinoh
Traceback (most recent call last):
  File "/home/asottile/workspace/cpython/prefix/lib/python3.10/runpy.py", line 187, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/home/asottile/workspace/cpython/prefix/lib/python3.10/runpy.py", line 146, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/home/asottile/workspace/cpython/prefix/lib/python3.10/runpy.py", line 110, in _get_module_details
    __import__(pkg_name)
  File "/tmp/rinohtype/venv/lib/python3.10/site-packages/rinoh/__init__.py", line 41, in <module>
    from . import resource
  File "/tmp/rinohtype/venv/lib/python3.10/site-packages/rinoh/resource.py", line 205, in <module>
    from .template import DocumentTemplate
  File "/tmp/rinohtype/venv/lib/python3.10/site-packages/rinoh/template.py", line 42, in <module>
    from .stylesheets import sphinx
  File "/tmp/rinohtype/venv/lib/python3.10/site-packages/rinoh/stylesheets/__init__.py", line 42, in <module>
    .format(stylesheet.description, stylesheet))
  File "/tmp/rinohtype/venv/lib/python3.10/site-packages/rinoh/style.py", line 670, in __str__
    for name, entry_point in self.installed_resources:
  File "/tmp/rinohtype/venv/lib/python3.10/site-packages/rinoh/resource.py", line 54, in installed_resources
    for entry_point in ilm.entry_points()[cls.entry_point_group]:
  File "/home/asottile/workspace/cpython/prefix/lib/python3.10/importlib/metadata/__init__.py", line 979, in entry_points
    return SelectableGroups.load(eps).select(**params)
  File "/home/asottile/workspace/cpython/prefix/lib/python3.10/importlib/metadata/__init__.py", line 437, in load
    ordered = sorted(eps, key=by_group)
  File "/home/asottile/workspace/cpython/prefix/lib/python3.10/importlib/metadata/__init__.py", line -1, in <genexpr>
  File "/home/asottile/workspace/cpython/prefix/lib/python3.10/importlib/metadata/_itertools.py", line 16, in unique_everseen
    k = key(element)
  File "/home/asottile/workspace/cpython/prefix/lib/python3.10/importlib/metadata/__init__.py", line 600, in _normalized_name
    return Prepared.normalize(self.name)
  File "/home/asottile/workspace/cpython/prefix/lib/python3.10/importlib/metadata/__init__.py", line 841, in normalize
    return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_')
  File "/home/asottile/workspace/cpython/prefix/lib/python3.10/re.py", line 187, in sub
    return _compile(pattern, flags).sub(repl, string, count)
TypeError: expected string or bytes-like object
```

----------
components: Library (Lib)
messages: 396117
nosy: Anthony Sottile, jaraco, pablogsal
priority: normal
severity: normal
status: open
title: 3.10b2 -> 3.10b3 regression in importlib.metadata for rinoh
type: crash
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44459>
_______________________________________


More information about the New-bugs-announce mailing list