Skip to content

files property should never be None #69

@jaraco

Description

@jaraco

In GitLab by @JohannesBuchner on Jun 11, 2019, 15:59

Hi,

I noticed pytest has an issue interpreting the files property being None. I wonder if you would accept the following patch:

diff --git a/importlib_metadata/__init__.py b/importlib_metadata/__init__.py
index 1d0a1bd..e12a3ce 100644
--- a/importlib_metadata/__init__.py
+++ b/importlib_metadata/__init__.py
@@ -240,7 +240,7 @@ class Distribution:
             result.dist = self
             return result
 
-        return file_lines and starmap(make_file, csv.reader(file_lines))
+        return starmap(make_file, csv.reader(file_lines)) if file_lines else []
 
     def _read_files_distinfo(self):
         """

A list seems much more natural for the files property.

Cheers,
Johannes

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