Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ their individual contributions.
* `Louis Taylor <https://github.com/kragniz>`_
* `Luke Barone-Adesi <https://github.com/baluke>`_
* `Lundy Bernard <https://github.com/lundybernard>`_
* `Marco Ricci <https://github.com/the-13th-letter>`_
* `Marco Sirabella <https://www.github.com/mjsir911>`_
* `marekventur <https://www.github.com/marekventur>`_
* `Marius Gedminas <https://www.github.com/mgedmin>`_ ([email protected])
Expand Down
7 changes: 7 additions & 0 deletions hypothesis-python/RELEASE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
RELEASE_TYPE: patch

This patch restores compatibility when using `the legacy Python 3.9 LL(1)
parser <https://docs.python.org/3/whatsnew/3.9.html#new-parser>`__, which
was accidentally broken since :ref:`version 6.130.13 <v6.130.13>`.

Thanks to Marco Ricci for this fix!
25 changes: 13 additions & 12 deletions hypothesis-python/src/hypothesis/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1102,18 +1102,19 @@ def run(data: ConjectureData) -> None:

# self.test_runner can include the execute_example method, or setup/teardown
# _example, so it's important to get the PRNG and build context in place first.
with (
local_settings(self.settings),
deterministic_PRNG(),
BuildContext(data, is_final=is_final) as context,
):
# providers may throw in per_case_context_fn, and we'd like
# `result` to still be set in these cases.
result = None
with data.provider.per_test_case_context_manager():
# Run the test function once, via the executor hook.
# In most cases this will delegate straight to `run(data)`.
result = self.test_runner(data, run)
#
# NOTE: For compatibility with Python 3.9's LL(1) parser, this is written as
# three nested with-statements, instead of one compound statement.
with local_settings(self.settings):
with deterministic_PRNG():
with BuildContext(data, is_final=is_final) as context:
# providers may throw in per_case_context_fn, and we'd like
# `result` to still be set in these cases.
result = None
with data.provider.per_test_case_context_manager():
# Run the test function once, via the executor hook.
# In most cases this will delegate straight to `run(data)`.
result = self.test_runner(data, run)

# If a failure was expected, it should have been raised already, so
# instead raise an appropriate diagnostic error.
Expand Down