Skip to content

TypeError in importlib.metadata when distribution metadata has no name #100455

Closed
@jack9603301

Description

@jack9603301

Bug report

A clear and concise description of what the bug is.
Include a minimal, reproducible example (https://stackoverflow.com/help/minimal-reproducible-example), if possible.

I don't know how to describe this bug, see

图片

The problem is with the following code:

@staticmethod
def normalize(name):
"""
PEP 503 normalization plus dashes as underscores.
"""
return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_')

    @staticmethod
    def normalize(name):
        """
        PEP 503 normalization plus dashes as underscores.
        """
        return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_')


The fixes are as follows:

图片

Guess the reason is that in some cases, name may be a None, if no judgment is made, an exception will always be thrown under certain conditions, which causes an exception in my gentoo regardless of any python3.10 library installed

Your environment

gentoo/Linux

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions