Skip to content

Commit 14d9b2b

Browse files
committed
fixes
1 parent 96d74dc commit 14d9b2b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

hypothesis-python/RELEASE.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
RELEASE_TYPE: patch
22

3-
Hypothesis collects coverage information during the :ref:`shrinking hypothesis.Phase.shrink` and :ref:`explain hypothesis.Phase.explain` phases in order to show a more informative error message. On 3.12+, this uses :mod:`sys.monitoring`. This patch improves the performance of coverage collection on 3.12+ by disabling events we don't need.
3+
Hypothesis collects coverage information during the ``shrink`` and ``explain`` :ref:`phases <phases>` in order to show a more informative error message. On 3.12+, this uses :mod:`sys.monitoring`. This patch improves the performance of coverage collection on 3.12+ by disabling events we don't need.

hypothesis-python/src/hypothesis/internal/scrutineer.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ def trace(self, frame, event, arg):
8787
def trace_line(self, code: types.CodeType, line_number: int) -> None:
8888
fname = code.co_filename
8989
if not should_trace_file(fname):
90-
return sys.monitoring.DISABLE
90+
# this function is only called on 3.12+, but we want to avoid an
91+
# assertion to that effect for performance.
92+
return sys.monitoring.DISABLE # type: ignore
9193

9294
current_location = (fname, line_number)
9395
self.branches.add((self._previous_location, current_location))

0 commit comments

Comments
 (0)