crosshair-tool 0.0.92__cp311-cp311-musllinux_1_2_x86_64.whl → 0.0.93__cp311-cp311-musllinux_1_2_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of crosshair-tool might be problematic. Click here for more details.

crosshair/__init__.py CHANGED
@@ -15,7 +15,7 @@ from crosshair.statespace import StateSpace
15
15
  from crosshair.tracers import NoTracing, ResumedTracing
16
16
  from crosshair.util import IgnoreAttempt, debug
17
17
 
18
- __version__ = "0.0.92" # Do not forget to update in setup.py!
18
+ __version__ = "0.0.93" # Do not forget to update in setup.py!
19
19
  __author__ = "Phillip Schanely"
20
20
  __license__ = "MIT"
21
21
  __status__ = "Alpha"
crosshair/core.py CHANGED
@@ -329,9 +329,10 @@ def with_realized_args(fn: Callable, deep=False) -> Callable:
329
329
 
330
330
  def realizer(*a, **kw):
331
331
  with NoTracing():
332
- a = map(realize_fn, a)
332
+ a = [realize_fn(arg) for arg in a]
333
333
  kw = {k: realize_fn(v) for (k, v) in kw.items()}
334
- return fn(*a, **kw)
334
+ # You might think we don't need tracing here, but some operations can invoke user-defined behavior:
335
+ return fn(*a, **kw)
335
336
 
336
337
  functools.update_wrapper(realizer, fn)
337
338
  return realizer
@@ -4441,10 +4441,11 @@ def _int(val: Any = 0, base=_MISSING):
4441
4441
  else:
4442
4442
  ret = (ret * base) + ch_num
4443
4443
  return ret
4444
- if base is _MISSING:
4445
- return int(deep_realize(val))
4446
- else:
4447
- return int(deep_realize(val), base=realize(base))
4444
+ elif isinstance(val, CrossHairValue):
4445
+ val = deep_realize(val)
4446
+ base = deep_realize(base)
4447
+
4448
+ return int(val) if base is _MISSING else int(val, base=base)
4448
4449
 
4449
4450
 
4450
4451
  _FLOAT_REGEX = re.compile(
@@ -4549,7 +4550,7 @@ def _len(ls):
4549
4550
  def _map(fn, *iters):
4550
4551
  # Wrap the `map` callback in a pure Python lambda.
4551
4552
  # This de-optimization ensures that the callback can be intercepted.
4552
- return map(lambda x: fn(x), *iters)
4553
+ return map(lambda *a: fn(*a), *iters)
4553
4554
 
4554
4555
 
4555
4556
  def _memoryview(source):
@@ -5,7 +5,8 @@ from crosshair.core import deep_realize
5
5
  from crosshair.core_and_libs import proxy_for_type
6
6
  from crosshair.statespace import POST_FAIL
7
7
  from crosshair.test_util import check_states
8
- from crosshair.tracers import ResumedTracing
8
+ from crosshair.tracers import ResumedTracing, is_tracing
9
+ from crosshair.util import CrossHairInternal
9
10
 
10
11
 
11
12
  def test_fraction_realize(space):
@@ -16,6 +17,28 @@ def test_fraction_realize(space):
16
17
  deep_realize(Fraction(n, d))
17
18
 
18
19
 
20
+ class UserFraction(Fraction):
21
+ def __int__(self):
22
+ if not is_tracing():
23
+ raise CrossHairInternal("tracing required while in user code")
24
+ return 1
25
+
26
+ def __round__(self, *a, **kw):
27
+ if not is_tracing():
28
+ raise CrossHairInternal("tracing required while in user code")
29
+ return super().__round__(*a, **kw)
30
+
31
+
32
+ def test_user_fraction_tracing(space):
33
+ n = proxy_for_type(int, "n")
34
+ d = proxy_for_type(int, "d")
35
+ with ResumedTracing():
36
+ space.add(d != 0)
37
+ fraction = UserFraction(n, d)
38
+ round(fraction) # (works via with_realized_args)
39
+ int(fraction) # (custom interception)
40
+
41
+
19
42
  def test_fraction_copy_doesnt_realize(space):
20
43
  n = proxy_for_type(int, "n")
21
44
  with ResumedTracing():
@@ -1,5 +1,6 @@
1
1
  import copy
2
2
  import itertools
3
+ import operator
3
4
  import re
4
5
  import sys
5
6
  from dataclasses import dataclass
@@ -39,6 +40,7 @@ possible_args = [
39
40
  (42, int), # isinstance
40
41
  (re.compile("(ab|a|b)"), r"\n", ""), # re methods
41
42
  (bool, [1, 1, 0]), # itertools.takewhile and friends
43
+ (operator.add, [1, 0], [1, 1]), # multi-iterable map
42
44
  ([(1, 2), (3, 4)]), # key-value pairs
43
45
  ([(1, 2), ([], 4)]), # key-value pairs w/ unhashable key
44
46
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crosshair-tool
3
- Version: 0.0.92
3
+ Version: 0.0.93
4
4
  Summary: Analyze Python code for correctness using symbolic execution.
5
5
  Home-page: https://github.com/pschanely/CrossHair
6
6
  Author: Phillip Schanely
@@ -47,6 +47,7 @@ Requires-Dist: setuptools; extra == "dev"
47
47
  Requires-Dist: sphinx>=3.4.3; extra == "dev"
48
48
  Requires-Dist: sphinx-rtd-theme>=0.5.1; extra == "dev"
49
49
  Requires-Dist: rst2pdf>=0.102; extra == "dev"
50
+ Requires-Dist: z3-solver==4.14.1.0; extra == "dev"
50
51
  Dynamic: author
51
52
  Dynamic: author-email
52
53
  Dynamic: classifier
@@ -1,5 +1,5 @@
1
1
  _crosshair_tracers.cpython-311-x86_64-linux-musl.so,sha256=X29qmdDPfNvzcHzA-zgYCe77SsxT7XSEEimNusO_Riw,75528
2
- crosshair/__init__.py,sha256=pMTYFz7JCsH9F93C11wN9P-sZKW9G1H1Dxfu_XdZHkg,936
2
+ crosshair/__init__.py,sha256=LfHa3bjHbl9WlLnVFSn-2R3qe0yEptc8-0Edze71rmo,936
3
3
  crosshair/__main__.py,sha256=zw9Ylf8v2fGocE57o4FqvD0lc7U4Ld2GbeCGxRWrpqo,252
4
4
  crosshair/_mark_stacks.h,sha256=j86qubOUvVhoR19d74iQ084RrTEq8M6oT4wJsGQUySY,28678
5
5
  crosshair/_preliminaries_test.py,sha256=r2PohNNMfIkDqsnvI6gKlJTbwBaZA9NQJueQfJMN2Eo,504
@@ -16,7 +16,7 @@ crosshair/condition_parser_test.py,sha256=eUQYnVkHewn8qg-XbzcElb0mHkPxPJAX548dPV
16
16
  crosshair/conftest.py,sha256=BkLszApkdy6FrvzaHO7xh8_BJrG9AfytFTse-HuQVvg,653
17
17
  crosshair/copyext.py,sha256=GBGQP9YAHoezLXwb_M59Hh1VXSou5EQt4ZmmUA0T_og,4899
18
18
  crosshair/copyext_test.py,sha256=uJzdC9m2FqMjqQ-ITFoP0MZg3OCiO8paU-d533KocD8,2108
19
- crosshair/core.py,sha256=K7147xrvcvtrP1T9oIRywq2uHMMsIu8ZwFZWBQXPozg,63634
19
+ crosshair/core.py,sha256=YegFbe3RMJwxHCadhJ42gUJjL9mICaLAE_Dmb1-lsK4,63750
20
20
  crosshair/core_and_libs.py,sha256=8FGL62GnyX6WHOqKh0rqJ0aJ_He5pwZm_zwPXTaPqhI,3963
21
21
  crosshair/core_regestered_types_test.py,sha256=er3ianvu-l0RS-WrS46jmOWr4Jq06Cec9htAXGXJSNg,2099
22
22
  crosshair/core_test.py,sha256=H6qZFBFuUhgh9qWgxxc1Cs7xuC8s6FYvewmTYUh0Dpg,32200
@@ -39,7 +39,7 @@ crosshair/opcode_intercept.py,sha256=z4Yb9prYE2UK21AxhjAeXyXAk5IriDuCSSCeNhbDu2A
39
39
  crosshair/opcode_intercept_test.py,sha256=Si3rJQR5cs5d4uB8uwE2K8MjP8rE1a4yHkjXzhfS10A,9241
40
40
  crosshair/options.py,sha256=htQNgnrpoRjSNq6rfLBAF8nos-NNIwmP6tQYyI8ugsM,6775
41
41
  crosshair/options_test.py,sha256=lzA-XtwEwQPa4wV1wwhCRKhyLOvIhThU9WK5QRaRbxQ,379
42
- crosshair/patch_equivalence_test.py,sha256=mvYpsbHZS2AiQra-jK8T8QywAG1gNNCUNQPPWI9k5t8,2506
42
+ crosshair/patch_equivalence_test.py,sha256=eoLaGRvrR9nGUO_ybZ9XsWhs5ejC4IEPd0k-ihG3Nsg,2580
43
43
  crosshair/path_cover.py,sha256=wV0Vy8IPDzqXQ2VI8a94FxltS9p-Y1oF17OKePjvpgs,6710
44
44
  crosshair/path_cover_test.py,sha256=U46zw4-m7yAXhu8-3Xnhvf-_9Ov5ivfCAm5euGwpRFA,4089
45
45
  crosshair/path_search.py,sha256=wwZjp-3E4dENnJa6BlnSq8FARkIx0PyUYc7kvH32A2k,5588
@@ -100,7 +100,7 @@ crosshair/libimpl/binascii_ch_test.py,sha256=hFqSfF1Q8jl2LNBIWaQ6vBJIIshPOmSwrR0
100
100
  crosshair/libimpl/binascii_test.py,sha256=LOBqLAJ77Kx8vorjVTaT3X0Z93zw4P5BvwUapMCiSLg,1970
101
101
  crosshair/libimpl/binasciilib.py,sha256=9w4C37uxRNOmz9EUuhJduHlMKn0f7baY5fwwdvx1uto,5070
102
102
  crosshair/libimpl/bisectlib_test.py,sha256=ZQtYmBYD0Pb1IiFelsgdvqyeUMKaqaDb1BRb87LTSbI,753
103
- crosshair/libimpl/builtinslib.py,sha256=0NRP8l_weL0kh050cOKMrqK8y-glh3NySYLJYjdHVz8,171622
103
+ crosshair/libimpl/builtinslib.py,sha256=UU2WDnQbPQMIETjvKfJlDXAFYyAXcRVvGt4SFYs-Jgk,171663
104
104
  crosshair/libimpl/builtinslib_ch_test.py,sha256=W4wWapqlxSjsC5XgREfgxS9e_iwKxgNQhbFE3umUfNI,30504
105
105
  crosshair/libimpl/builtinslib_test.py,sha256=Y_jRe5J6pPaJ_Nuk1lJ1biP5yczsfCj--NgNhwcbAfQ,90654
106
106
  crosshair/libimpl/codecslib.py,sha256=lB87T1EYSBh4JXaqzjSpQG9CMfKtgckwA7f6OIR0S-Q,2668
@@ -118,7 +118,7 @@ crosshair/libimpl/decimallib_ch_test.py,sha256=FVCY4KB8lJWeRKnz8txNkEc1te4QRKQYJ
118
118
  crosshair/libimpl/decimallib_test.py,sha256=393MkVB9-LPcA7JJK6wGAbDyd-YejkjwrXRaEDaVhjM,2238
119
119
  crosshair/libimpl/encodings_ch_test.py,sha256=0qLsioOuFUZkOjP4J9Wct4CGBaBY8BnHx9paZHnIofI,2513
120
120
  crosshair/libimpl/fractionlib.py,sha256=qdbiAHHC480YdKq3wYK_piZ3UD7oT64YfuNclypMUfQ,458
121
- crosshair/libimpl/fractionlib_test.py,sha256=lLMbGvzP5E_tnZ2Yi5_MawRxwqsSJZRW1A7vtgSSBvM,1638
121
+ crosshair/libimpl/fractionlib_test.py,sha256=g7uNHTfzDebyc-SgH_4ziUAz7rJLZlHGZmPpny2P6hs,2357
122
122
  crosshair/libimpl/functoolslib.py,sha256=LnMtmq2Sawde6XtPd6Yg_YOc6S5ai-pMpBWPQAkR3X4,783
123
123
  crosshair/libimpl/functoolslib_test.py,sha256=DswrS51n93EaxPvDGB-d3tZSLawEp38zQ5sNdYlbn50,1114
124
124
  crosshair/libimpl/hashliblib.py,sha256=Ki_cw28OnhZExgKbSoh5GaDbBfNRIOqH7O2aYQJGS3M,1234
@@ -167,9 +167,9 @@ crosshair/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
167
167
  crosshair/tools/check_help_in_doc.py,sha256=P21AH3mYrTVuBgWD6v65YXqBqmqpQDUTQeoZ10rB6TU,8235
168
168
  crosshair/tools/check_init_and_setup_coincide.py,sha256=kv61bXqKSKF_5J-kLNEhCrCPyszg7iZQWDu_Scnec98,3502
169
169
  crosshair/tools/generate_demo_table.py,sha256=0SeO0xQdiT-mbLNHt4rYL0wcc2DMh0v3qtzBdoQonDk,3831
170
- crosshair_tool-0.0.92.dist-info/METADATA,sha256=-Q5cwuR2jVjcs7GhtXcfKPD6uHAvzQpC3a04gXmjGUQ,6726
171
- crosshair_tool-0.0.92.dist-info/WHEEL,sha256=kA_iIvT-cxTFNl4I8QDfFHN1DAyqZDYakVXCaObxeLo,112
172
- crosshair_tool-0.0.92.dist-info/entry_points.txt,sha256=u5FIPVn1jqn4Kzg5K_iNnbP6L4hQw5FWjQ0UMezG2VE,96
173
- crosshair_tool-0.0.92.dist-info/top_level.txt,sha256=2jLWtM-BWg_ZYNbNfrcds0HFZD62a6J7ZIbcgcQrRk4,29
174
- crosshair_tool-0.0.92.dist-info/RECORD,,
175
- crosshair_tool-0.0.92.dist-info/licenses/LICENSE,sha256=NVyMvNqn1pH6RSHs6RWRcJyJvORnpgGFBlF73buqYJ0,4459
170
+ crosshair_tool-0.0.93.dist-info/METADATA,sha256=EYRE-NAWbA23Od5TfsbHDQ_R70UNonJPNCdNawPlT-c,6777
171
+ crosshair_tool-0.0.93.dist-info/WHEEL,sha256=kA_iIvT-cxTFNl4I8QDfFHN1DAyqZDYakVXCaObxeLo,112
172
+ crosshair_tool-0.0.93.dist-info/entry_points.txt,sha256=u5FIPVn1jqn4Kzg5K_iNnbP6L4hQw5FWjQ0UMezG2VE,96
173
+ crosshair_tool-0.0.93.dist-info/top_level.txt,sha256=2jLWtM-BWg_ZYNbNfrcds0HFZD62a6J7ZIbcgcQrRk4,29
174
+ crosshair_tool-0.0.93.dist-info/RECORD,,
175
+ crosshair_tool-0.0.93.dist-info/licenses/LICENSE,sha256=NVyMvNqn1pH6RSHs6RWRcJyJvORnpgGFBlF73buqYJ0,4459