Skip to content

Commit

Permalink
fix: revert "Map also empty dictionaries to file" (#1629)
Browse files Browse the repository at this point in the history
* Revert "Map also empty dictionaries to file"

This reverts commit f54428f (#1347),
which was a big regression in performance and file sizes when using
dynamic_context, and is no longer needed for #972 as of
4cc3292 (#1538).

Fixes #1586.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>

* docs: details of the fix in pull #1629, fixing #1586.

---------

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
  • Loading branch information
andersk and nedbat committed May 29, 2023
1 parent 586b1ee commit 6df9ee5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
9 changes: 8 additions & 1 deletion CHANGES.rst
Expand Up @@ -20,7 +20,14 @@ development at the same time, such as 4.5.x and 5.0.
Unreleased
----------

Nothing yet.
- Fix: reverted a `change from 6.4.3 <pull 1347_>`_ that helped Cython, but
also increased the size of data files when using dynamic contexts, as
described in the now-fixed `issue 1586`_. The problem is now avoided due to a
recent change (`issue 1538`_). Thanks to `Anders Kaseorg <pull 1629_>`_
and David Szotten for persisting with problem reports and detailed diagnoses.

.. _issue 1586: https://github.com/nedbat/coveragepy/issues/1586
.. _pull 1629: https://github.com/nedbat/coveragepy/pull/1629


.. scriv-start-here
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Expand Up @@ -16,6 +16,7 @@ Alexander Todorov
Alexander Walters
Alpha Chen
Ammar Askar
Anders Kaseorg
Andrew Hoos
Anthony Sottile
Arcadiy Ivanov
Expand Down
2 changes: 1 addition & 1 deletion coverage/collector.py
Expand Up @@ -456,7 +456,7 @@ def mapped_file_dict(self, d: Mapping[str, T]) -> Dict[str, T]:
assert isinstance(runtime_err, Exception)
raise runtime_err

return {self.cached_mapped_file(k): v for k, v in items}
return {self.cached_mapped_file(k): v for k, v in items if v}

def plugin_was_disabled(self, plugin: CoveragePlugin) -> None:
"""Record that `plugin` was disabled during the run."""
Expand Down

0 comments on commit 6df9ee5

Please sign in to comment.