Skip to content

Commit 3c1350d

Browse files
authored
Merge pull request #4119 from HypothesisWorks/create-pull-request/patch
Update pinned dependencies
2 parents 75650b9 + 2958a45 commit 3c1350d

File tree

8 files changed

+56
-21
lines changed

8 files changed

+56
-21
lines changed

hypothesis-python/RELEASE.rst

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
RELEASE_TYPE: patch
2+
3+
This patch fixes an internal error when the ``__context__``
4+
attribute of a raised exception leads to a cycle (:issue:`4115`).

hypothesis-python/setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ def local_file(name):
6060
"pytest": ["pytest>=4.6"],
6161
"dpcontracts": ["dpcontracts>=0.4"],
6262
"redis": ["redis>=3.0.0"],
63-
"crosshair": ["hypothesis-crosshair>=0.0.14", "crosshair-tool>=0.0.71"],
63+
"crosshair": ["hypothesis-crosshair>=0.0.14", "crosshair-tool>=0.0.72"],
6464
# zoneinfo is an odd one: every dependency is conditional, because they're
6565
# only necessary on old versions of Python or Windows systems or emscripten.
6666
"zoneinfo": [
67-
"tzdata>=2024.1 ; sys_platform == 'win32' or sys_platform == 'emscripten'",
67+
"tzdata>=2024.2 ; sys_platform == 'win32' or sys_platform == 'emscripten'",
6868
"backports.zoneinfo>=0.2.1 ; python_version<'3.9'",
6969
],
7070
# We only support Django versions with upstream support - see

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

+12-4
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
import sys
1414
import textwrap
1515
import traceback
16+
from functools import partial
1617
from inspect import getframeinfo
1718
from pathlib import Path
18-
from typing import Dict, NamedTuple, Optional, Type
19+
from typing import Dict, NamedTuple, Optional, Tuple, Type
1920

2021
import hypothesis
2122
from hypothesis.errors import _Trimmable
@@ -107,20 +108,27 @@ def __str__(self) -> str:
107108
return f"{self.exc_type.__name__} at {self.filename}:{self.lineno}{ctx}{group}"
108109

109110
@classmethod
110-
def from_exception(cls, exception: BaseException, /) -> "InterestingOrigin":
111+
def from_exception(
112+
cls, exception: BaseException, /, seen: Tuple[BaseException, ...] = ()
113+
) -> "InterestingOrigin":
111114
filename, lineno = None, None
112115
if tb := get_trimmed_traceback(exception):
113116
filename, lineno, *_ = traceback.extract_tb(tb)[-1]
117+
seen = (*seen, exception)
118+
make = partial(cls.from_exception, seen=seen)
119+
context: "InterestingOrigin | tuple[()]" = ()
120+
if exception.__context__ is not None and exception.__context__ not in seen:
121+
context = make(exception.__context__)
114122
return cls(
115123
type(exception),
116124
filename,
117125
lineno,
118126
# Note that if __cause__ is set it is always equal to __context__, explicitly
119127
# to support introspection when debugging, so we can use that unconditionally.
120-
cls.from_exception(exception.__context__) if exception.__context__ else (),
128+
context,
121129
# We distinguish exception groups by the inner exceptions, as for __context__
122130
(
123-
tuple(map(cls.from_exception, exception.exceptions))
131+
tuple(make(exc) for exc in exception.exceptions if exc not in seen)
124132
if isinstance(exception, BaseExceptionGroup)
125133
else ()
126134
),

hypothesis-python/src/hypothesis/vendor/tlds-alpha-by-domain.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Version 2024071300, Last Updated Sat Jul 13 07:07:01 2024 UTC
1+
# Version 2024092800, Last Updated Sat Sep 28 07:07:01 2024 UTC
22
AAA
33
AARP
44
ABB
@@ -297,7 +297,6 @@ CY
297297
CYMRU
298298
CYOU
299299
CZ
300-
DABUR
301300
DAD
302301
DANCE
303302
DATA

hypothesis-python/tests/cover/test_escalation.py

+23
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,26 @@ def test_handles_groups():
7070
assert "ExceptionGroup at " in str(origin)
7171
assert "child exception" in str(origin)
7272
assert "ValueError at " in str(origin)
73+
74+
75+
def make_exceptions_with_cycles():
76+
err = ValueError()
77+
err.__context__ = err
78+
yield err
79+
80+
err = TypeError()
81+
err.__context__ = BaseExceptionGroup("msg", [err])
82+
yield err
83+
84+
inner = LookupError()
85+
err = BaseExceptionGroup("msg", [inner])
86+
inner.__context__ = err
87+
yield err
88+
89+
inner = OSError()
90+
yield BaseExceptionGroup("msg", [inner, inner, inner])
91+
92+
93+
@pytest.mark.parametrize("err", list(make_exceptions_with_cycles()))
94+
def test_handles_cycles(err):
95+
esc.InterestingOrigin.from_exception(err)

requirements/coverage.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ exceptiongroup==1.2.2 ; python_version < "3.11"
2828
# pytest
2929
execnet==2.1.1
3030
# via pytest-xdist
31-
fakeredis==2.24.1
31+
fakeredis==2.25.0
3232
# via -r requirements/coverage.in
3333
iniconfig==2.0.0
3434
# via pytest
@@ -80,7 +80,7 @@ pytz==2024.2
8080
# pandas
8181
pyyaml==6.0.2
8282
# via libcst
83-
redis==5.0.8
83+
redis==5.1.0
8484
# via fakeredis
8585
six==1.16.0
8686
# via python-dateutil
@@ -98,5 +98,5 @@ typing-extensions==4.12.2
9898
# -r requirements/coverage.in
9999
# black
100100
# fakeredis
101-
tzdata==2024.1
101+
tzdata==2024.2
102102
# via pandas

requirements/fuzzing.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ exceptiongroup==1.2.2 ; python_version < "3.11"
5151
# pytest
5252
execnet==2.1.1
5353
# via pytest-xdist
54-
fakeredis==2.24.1
54+
fakeredis==2.25.0
5555
# via -r requirements/coverage.in
5656
flask==3.0.3
5757
# via dash
58-
hypofuzz==24.2.3
58+
hypofuzz==24.9.1
5959
# via -r requirements/fuzzing.in
6060
hypothesis[cli]==6.112.1
6161
# via hypofuzz
@@ -139,7 +139,7 @@ pytz==2024.2
139139
# pandas
140140
pyyaml==6.0.2
141141
# via libcst
142-
redis==5.0.8
142+
redis==5.1.0
143143
# via fakeredis
144144
requests==2.32.3
145145
# via
@@ -171,7 +171,7 @@ typing-extensions==4.12.2
171171
# black
172172
# dash
173173
# fakeredis
174-
tzdata==2024.1
174+
tzdata==2024.2
175175
# via pandas
176176
urllib3==2.2.3
177177
# via requests

requirements/tools.txt

+7-6
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ jaraco-classes==3.4.0
105105
# via keyring
106106
jaraco-context==6.0.1
107107
# via keyring
108-
jaraco-functools==4.0.2
108+
jaraco-functools==4.1.0
109109
# via keyring
110110
jedi==0.19.1
111111
# via ipython
@@ -167,7 +167,7 @@ parso==0.8.4
167167
# via jedi
168168
pathspec==0.12.1
169169
# via black
170-
pelican[markdown]==4.10.0
170+
pelican[markdown]==4.10.1
171171
# via -r requirements/tools.in
172172
pexpect==4.9.0
173173
# via ipython
@@ -184,7 +184,7 @@ pluggy==1.5.0
184184
# via
185185
# pytest
186186
# tox
187-
prompt-toolkit==3.0.47
187+
prompt-toolkit==3.0.48
188188
# via ipython
189189
ptyprocess==0.7.0
190190
# via pexpect
@@ -207,7 +207,7 @@ pyproject-hooks==1.1.0
207207
# via
208208
# build
209209
# pip-tools
210-
pyright==1.1.381
210+
pyright==1.1.382.post1
211211
# via -r requirements/tools.in
212212
pytest==8.3.3
213213
# via -r requirements/tools.in
@@ -242,7 +242,7 @@ rich==13.8.1
242242
# via
243243
# pelican
244244
# twine
245-
ruff==0.6.7
245+
ruff==0.6.8
246246
# via -r requirements/tools.in
247247
secretstorage==3.3.3
248248
# via keyring
@@ -338,13 +338,14 @@ typing-extensions==4.12.2
338338
# black
339339
# ipython
340340
# mypy
341+
# pyright
341342
unidecode==1.3.8
342343
# via pelican
343344
urllib3==2.2.3
344345
# via
345346
# requests
346347
# twine
347-
virtualenv==20.26.5
348+
virtualenv==20.26.6
348349
# via tox
349350
watchfiles==0.24.0
350351
# via pelican

0 commit comments

Comments
 (0)