From 768b2f576033a53ea89071f679c875d7e1f1a82b Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Tue, 16 May 2023 16:39:45 -0700 Subject: [PATCH 1/2] Revert "Map also empty dictionaries to file" This reverts commit f54428fb8dfe98aacecc0b66e3c1ca2071ce1834 (#1347), which was a big regression in performance and file sizes when using dynamic_context, and is no longer needed for #972 as of 4cc32922685c6971275f522304b3754ad1a233c1 (#1538). Fixes #1586. Signed-off-by: Anders Kaseorg --- coverage/collector.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coverage/collector.py b/coverage/collector.py index 2f8c17520..ca7f5d94b 100644 --- a/coverage/collector.py +++ b/coverage/collector.py @@ -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.""" From 1d75256dd70d81f6e3b379ff97b46af3b0770f1c Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Mon, 29 May 2023 12:38:42 -0400 Subject: [PATCH 2/2] docs: details of the fix in pull #1629, fixing #1586. --- CHANGES.rst | 9 ++++++++- CONTRIBUTORS.txt | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 2f9dd0e55..938f10da1 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -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 `_ 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 `_ + 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 diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 91f914ba3..c3dfef428 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -16,6 +16,7 @@ Alexander Todorov Alexander Walters Alpha Chen Ammar Askar +Anders Kaseorg Andrew Hoos Anthony Sottile Arcadiy Ivanov