Skip to content

Commit 866a112

Browse files
committed
Add more patches for hypothesis
1 parent dcc83d5 commit 866a112

File tree

4 files changed

+219
-3
lines changed

4 files changed

+219
-3
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
diff --git a/hypothesis/core.py b/hypothesis/core.py
2+
index c276742..3031790 100644
3+
--- a/hypothesis/core.py
4+
+++ b/hypothesis/core.py
5+
@@ -69,6 +69,7 @@ from hypothesis.errors import (
6+
)
7+
from hypothesis.internal.compat import (
8+
PYPY,
9+
+ GRAALPY,
10+
BaseExceptionGroup,
11+
add_note,
12+
bad_django_TestCase,
13+
@@ -1021,9 +1022,9 @@ class StateForActualGivenExecution:
14+
)
15+
16+
_can_trace = (
17+
- (sys.version_info[:2] < (3, 12) and sys.gettrace() is None)
18+
+ ((sys.version_info[:2] < (3, 12) or GRAALPY) and sys.gettrace() is None)
19+
or (
20+
- sys.version_info[:2] >= (3, 12)
21+
+ sys.version_info[:2] >= (3, 12) and not GRAALPY
22+
and sys.monitoring.get_tool(MONITORING_TOOL_ID) is None
23+
)
24+
) and not PYPY
25+
diff --git a/hypothesis/internal/scrutineer.py b/hypothesis/internal/scrutineer.py
26+
index d99e767..fb4529b 100644
27+
--- a/hypothesis/internal/scrutineer.py
28+
+++ b/hypothesis/internal/scrutineer.py
29+
@@ -22,6 +22,7 @@ from typing import TYPE_CHECKING, Dict, List, Optional, Set, Tuple
30+
31+
from hypothesis._settings import Phase, Verbosity
32+
from hypothesis.internal.escalation import is_hypothesis_file
33+
+from hypothesis.internal.compat import GRAALPY
34+
35+
if TYPE_CHECKING:
36+
from typing import TypeAlias
37+
@@ -45,7 +46,7 @@ def should_trace_file(fname):
38+
# tool_id = 1 is designated for coverage, but we intentionally choose a
39+
# non-reserved tool id so we can co-exist with coverage tools.
40+
MONITORING_TOOL_ID = 3
41+
-if sys.version_info[:2] >= (3, 12):
42+
+if sys.version_info[:2] >= (3, 12) and not GRAALPY:
43+
MONITORING_EVENTS = {sys.monitoring.events.LINE: "trace_line"}
44+
45+
46+
@@ -80,7 +81,7 @@ class Tracer:
47+
self._previous_location = current_location
48+
49+
def __enter__(self):
50+
- if sys.version_info[:2] < (3, 12):
51+
+ if sys.version_info[:2] < (3, 12) or GRAALPY:
52+
assert sys.gettrace() is None # caller checks in core.py
53+
sys.settrace(self.trace)
54+
return self
55+
@@ -94,7 +95,7 @@ class Tracer:
56+
return self
57+
58+
def __exit__(self, *args, **kwargs):
59+
- if sys.version_info[:2] < (3, 12):
60+
+ if sys.version_info[:2] < (3, 12) or GRAALPY:
61+
sys.settrace(None)
62+
return
63+
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
diff --git a/hypothesis/core.py b/hypothesis/core.py
2+
index b04235c..ac65b68 100644
3+
--- a/hypothesis/core.py
4+
+++ b/hypothesis/core.py
5+
@@ -70,6 +70,7 @@ from hypothesis.errors import (
6+
)
7+
from hypothesis.internal.compat import (
8+
PYPY,
9+
+ GRAALPY,
10+
BaseExceptionGroup,
11+
add_note,
12+
bad_django_TestCase,
13+
@@ -1166,7 +1167,7 @@ class StateForActualGivenExecution:
14+
# we'd expect to do so reliably, i.e. on CPython>=3.12)
15+
if (
16+
sys.version_info[:2] >= (3, 12)
17+
- and not PYPY
18+
+ and not PYPY and not GRAALPY
19+
and self._should_trace()
20+
and not Tracer.can_trace()
21+
): # pragma: no cover
22+
diff --git a/hypothesis/internal/scrutineer.py b/hypothesis/internal/scrutineer.py
23+
index 0cd760c..60bb7a2 100644
24+
--- a/hypothesis/internal/scrutineer.py
25+
+++ b/hypothesis/internal/scrutineer.py
26+
@@ -21,7 +21,7 @@ from pathlib import Path
27+
from typing import TYPE_CHECKING, Dict, List, Optional, Set, Tuple
28+
29+
from hypothesis._settings import Phase, Verbosity
30+
-from hypothesis.internal.compat import PYPY
31+
+from hypothesis.internal.compat import PYPY, GRAALPY
32+
from hypothesis.internal.escalation import is_hypothesis_file
33+
34+
if TYPE_CHECKING:
35+
@@ -46,7 +46,7 @@ def should_trace_file(fname):
36+
# tool_id = 1 is designated for coverage, but we intentionally choose a
37+
# non-reserved tool id so we can co-exist with coverage tools.
38+
MONITORING_TOOL_ID = 3
39+
-if sys.version_info[:2] >= (3, 12):
40+
+if sys.version_info[:2] >= (3, 12) and not GRAALPY:
41+
MONITORING_EVENTS = {sys.monitoring.events.LINE: "trace_line"}
42+
43+
44+
@@ -64,7 +64,7 @@ class Tracer:
45+
return (
46+
(sys.version_info[:2] < (3, 12) and sys.gettrace() is None)
47+
or (
48+
- sys.version_info[:2] >= (3, 12)
49+
+ sys.version_info[:2] >= (3, 12) and not GRAALPY
50+
and sys.monitoring.get_tool(MONITORING_TOOL_ID) is None
51+
)
52+
) and not PYPY
53+
@@ -93,7 +93,7 @@ class Tracer:
54+
def __enter__(self):
55+
assert self.can_trace() # caller checks in core.py
56+
57+
- if sys.version_info[:2] < (3, 12):
58+
+ if sys.version_info[:2] < (3, 12) or GRAALPY:
59+
sys.settrace(self.trace)
60+
return self
61+
62+
@@ -106,7 +106,7 @@ class Tracer:
63+
return self
64+
65+
def __exit__(self, *args, **kwargs):
66+
- if sys.version_info[:2] < (3, 12):
67+
+ if sys.version_info[:2] < (3, 12) or GRAALPY:
68+
sys.settrace(None)
69+
return
70+
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
diff --git a/hypothesis/core.py b/hypothesis/core.py
2+
index 1ffa685..d1c1283 100644
3+
--- a/hypothesis/core.py
4+
+++ b/hypothesis/core.py
5+
@@ -68,6 +68,7 @@ from hypothesis.errors import (
6+
)
7+
from hypothesis.internal.compat import (
8+
PYPY,
9+
+ GRAALPY,
10+
BaseExceptionGroup,
11+
add_note,
12+
bad_django_TestCase,
13+
@@ -1171,7 +1172,7 @@ class StateForActualGivenExecution:
14+
# we'd expect to do so reliably, i.e. on CPython>=3.12)
15+
if (
16+
sys.version_info[:2] >= (3, 12)
17+
- and not PYPY
18+
+ and not PYPY and not GRAALPY
19+
and self._should_trace()
20+
and not Tracer.can_trace()
21+
): # pragma: no cover
22+
diff --git a/hypothesis/internal/scrutineer.py b/hypothesis/internal/scrutineer.py
23+
index 622a179..d66e80d 100644
24+
--- a/hypothesis/internal/scrutineer.py
25+
+++ b/hypothesis/internal/scrutineer.py
26+
@@ -22,7 +22,7 @@ from pathlib import Path
27+
from typing import TYPE_CHECKING, Optional
28+
29+
from hypothesis._settings import Phase, Verbosity
30+
-from hypothesis.internal.compat import PYPY
31+
+from hypothesis.internal.compat import PYPY, GRAALPY
32+
from hypothesis.internal.escalation import is_hypothesis_file
33+
34+
if TYPE_CHECKING:
35+
@@ -47,7 +47,7 @@ def should_trace_file(fname: str) -> bool:
36+
# tool_id = 1 is designated for coverage, but we intentionally choose a
37+
# non-reserved tool id so we can co-exist with coverage tools.
38+
MONITORING_TOOL_ID = 3
39+
-if sys.version_info[:2] >= (3, 12):
40+
+if sys.version_info[:2] >= (3, 12) and not GRAALPY:
41+
MONITORING_EVENTS = {sys.monitoring.events.LINE: "trace_line"}
42+
43+
44+
@@ -66,7 +66,7 @@ class Tracer:
45+
return (
46+
(sys.version_info[:2] < (3, 12) and sys.gettrace() is None)
47+
or (
48+
- sys.version_info[:2] >= (3, 12)
49+
+ sys.version_info[:2] >= (3, 12) and not GRAALPY
50+
and sys.monitoring.get_tool(MONITORING_TOOL_ID) is None
51+
)
52+
) and not PYPY
53+
@@ -96,7 +96,7 @@ class Tracer:
54+
if not self._should_trace:
55+
return self
56+
57+
- if sys.version_info[:2] < (3, 12):
58+
+ if sys.version_info[:2] < (3, 12) or GRAALPY:
59+
sys.settrace(self.trace)
60+
return self
61+
62+
@@ -112,7 +112,7 @@ class Tracer:
63+
if not self._should_trace:
64+
return
65+
66+
- if sys.version_info[:2] < (3, 12):
67+
+ if sys.version_info[:2] < (3, 12) or GRAALPY:
68+
sys.settrace(None)
69+
return
70+

graalpython/lib-graalpython/patches/metadata.toml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,28 @@ patch = 'hmmlearn.patch'
175175
license = 'BSD-3-Clause'
176176

177177
[[hypothesis.rules]]
178-
install-priority = 1
179178
# can be removed once [GR-65570] is done
180179
patch = 'hypothesis-6.135.0.patch'
181180
version = '>= 6.120.0'
182181
license = 'MPL-2.0'
183182

184183
[[hypothesis.rules]]
185-
install-priority = 0
186-
version = '>= 6.69.0, < 6.120.0'
184+
# can be removed once [GR-65570] is done
185+
patch = 'hypothesis-6.118.5.patch'
186+
version = '>= 6.118.5, < 6.120.0'
187+
license = 'MPL-2.0'
188+
189+
[[hypothesis.rules]]
190+
# can be removed once [GR-65570] is done
191+
patch = 'hypothesis-6.105.2.patch'
192+
version = '>= 6.105.2, < 6.118.5'
193+
license = 'MPL-2.0'
194+
195+
[[hypothesis.rules]]
196+
# can be removed once [GR-65570] is done
197+
patch = 'hypothesis-6.104.1.patch'
198+
version = '>= 6.99.0, < 6.105.2'
199+
license = 'MPL-2.0'
187200

188201
[[hypothesis.rules]]
189202
install-priority = 0

0 commit comments

Comments
 (0)