Skip to content

Commit f66b451

Browse files
committed
ch tests: realize args on exception
1 parent 2891ce3 commit f66b451

4 files changed

Lines changed: 21 additions & 3 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 07c19033a2877b1c36b0376d050d015b61adcfff

crosshair/test_util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,6 @@ def summarize_execution(
246246
ret = f"C-based callable {type(_ret).__name__}"
247247
else:
248248
ret = _ret
249-
args = deep_realize(args)
250-
kwargs = deep_realize(kwargs)
251249
except Exception as e:
252250
exc = e
253251
if detach_path:
@@ -258,6 +256,8 @@ def summarize_execution(
258256
tbstr = ch_stack(currently_handling=exc)
259257
if in_debug():
260258
debug("hit exception:", type(exc), exc, tbstr)
259+
args = deep_realize(args)
260+
kwargs = deep_realize(kwargs)
261261
return ExecutionResult(ret, exc, tbstr, args, kwargs)
262262

263263

crosshair/test_util_test.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
from crosshair.test_util import flexible_equal
1+
from crosshair.core import proxy_for_type
2+
from crosshair.core_and_libs import standalone_statespace
3+
from crosshair.test_util import flexible_equal, summarize_execution
4+
from crosshair.tracers import ResumedTracing
25

36

47
def test_flexible_equal():
@@ -24,3 +27,15 @@ def gen():
2427
ordered_dict_2 = {3: 4, 1: 2}
2528
assert list(ordered_dict_1.items()) != list(ordered_dict_2.items())
2629
assert flexible_equal(ordered_dict_1, ordered_dict_2)
30+
31+
32+
def test_summarize_execution_realizes_post_args_on_exception():
33+
def raiser(x):
34+
raise ValueError
35+
36+
with standalone_statespace:
37+
symbolic_int = proxy_for_type(int, "i")
38+
with ResumedTracing():
39+
result = summarize_execution(raiser, (symbolic_int,))
40+
assert type(result.exc) is ValueError
41+
assert type(result.post_args[0]) is int

crosshair/type_repo.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
"z3",
1818
# These are disabled for performance or type search effectiveness:
1919
"hypothesis",
20+
# pdb._ScriptTarget is assumption-breaking: it's a str subclass that can compare unequal after copy:
21+
"pdb",
2022
"pkg_resources",
2123
"pytest",
2224
"py", # (part of pytest)

0 commit comments

Comments
 (0)