crosshair-tool 0.0.92__cp310-cp310-macosx_10_9_x86_64.whl → 0.0.93__cp310-cp310-macosx_10_9_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_tracers.cpython-310-darwin.so +0 -0
- crosshair/__init__.py +1 -1
- crosshair/core.py +3 -2
- crosshair/libimpl/builtinslib.py +6 -5
- crosshair/libimpl/fractionlib_test.py +24 -1
- crosshair/patch_equivalence_test.py +2 -0
- {crosshair_tool-0.0.92.dist-info → crosshair_tool-0.0.93.dist-info}/METADATA +2 -1
- {crosshair_tool-0.0.92.dist-info → crosshair_tool-0.0.93.dist-info}/RECORD +12 -12
- {crosshair_tool-0.0.92.dist-info → crosshair_tool-0.0.93.dist-info}/WHEEL +0 -0
- {crosshair_tool-0.0.92.dist-info → crosshair_tool-0.0.93.dist-info}/entry_points.txt +0 -0
- {crosshair_tool-0.0.92.dist-info → crosshair_tool-0.0.93.dist-info}/licenses/LICENSE +0 -0
- {crosshair_tool-0.0.92.dist-info → crosshair_tool-0.0.93.dist-info}/top_level.txt +0 -0
|
Binary file
|
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.
|
|
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 =
|
|
332
|
+
a = [realize_fn(arg) for arg in a]
|
|
333
333
|
kw = {k: realize_fn(v) for (k, v) in kw.items()}
|
|
334
|
-
|
|
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
|
crosshair/libimpl/builtinslib.py
CHANGED
|
@@ -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
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
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
|
|
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.
|
|
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,4 +1,4 @@
|
|
|
1
|
-
_crosshair_tracers.cpython-310-darwin.so,sha256=
|
|
1
|
+
_crosshair_tracers.cpython-310-darwin.so,sha256=3XQnfewetTE4zFb-P6_A4N97TtUCDTZf8zL5cYly1YM,23568
|
|
2
2
|
crosshair/_tracers_pycompat.h,sha256=6IYnbQxrYkhBsLDAHSX25DPOwo1oYHCZUVWZ8c7YCnQ,14356
|
|
3
3
|
crosshair/pure_importer.py,sha256=-t4eowrZOQmfqK1N2tjI5POoaxRGavytwMmbRivelFg,878
|
|
4
4
|
crosshair/options.py,sha256=htQNgnrpoRjSNq6rfLBAF8nos-NNIwmP6tQYyI8ugsM,6775
|
|
@@ -23,8 +23,8 @@ crosshair/fnutil.py,sha256=X80bD2Lh4QAh-rF561r3JRxjxcuZepF3hJaxaj1GG9s,13123
|
|
|
23
23
|
crosshair/unicode_categories.py,sha256=g4pnUPanx8KkpwI06ZUGx8GR8Myruf_EpTjyti_V4z8,333519
|
|
24
24
|
crosshair/copyext.py,sha256=GBGQP9YAHoezLXwb_M59Hh1VXSou5EQt4ZmmUA0T_og,4899
|
|
25
25
|
crosshair/_tracers_test.py,sha256=KpCGspjOUeZuhwTYgn_RxI4M4wMbT5rldusFDgneQ6M,3596
|
|
26
|
-
crosshair/__init__.py,sha256=
|
|
27
|
-
crosshair/core.py,sha256=
|
|
26
|
+
crosshair/__init__.py,sha256=LfHa3bjHbl9WlLnVFSn-2R3qe0yEptc8-0Edze71rmo,936
|
|
27
|
+
crosshair/core.py,sha256=YegFbe3RMJwxHCadhJ42gUJjL9mICaLAE_Dmb1-lsK4,63750
|
|
28
28
|
crosshair/path_cover.py,sha256=wV0Vy8IPDzqXQ2VI8a94FxltS9p-Y1oF17OKePjvpgs,6710
|
|
29
29
|
crosshair/enforce_test.py,sha256=C6CQ4P1FjkdIJeJg3aJynp1iLDCE6BFCEVtSqXbvmQk,4665
|
|
30
30
|
crosshair/test_util.py,sha256=D9-f-DdzJemfAUkQL0cwKxPL8RZ-5gkVmghyRcKlBJI,10367
|
|
@@ -41,7 +41,7 @@ crosshair/pure_importer_test.py,sha256=Xjtlwn1mj7g-6VA87lrvzfUADCjlmn1wgHtbrnc0u
|
|
|
41
41
|
crosshair/fnutil_test.py,sha256=wXtfIxAupRm0KUzKob8luEsNI4YegBQUfwz7msWbfHY,2186
|
|
42
42
|
crosshair/stubs_parser_test.py,sha256=0itTT0Udul_51RJXNv6KB97z44gYze6NZfKJL7yIDzA,1228
|
|
43
43
|
crosshair/options_test.py,sha256=lzA-XtwEwQPa4wV1wwhCRKhyLOvIhThU9WK5QRaRbxQ,379
|
|
44
|
-
crosshair/patch_equivalence_test.py,sha256=
|
|
44
|
+
crosshair/patch_equivalence_test.py,sha256=eoLaGRvrR9nGUO_ybZ9XsWhs5ejC4IEPd0k-ihG3Nsg,2580
|
|
45
45
|
crosshair/abcstring.py,sha256=ROU8LzS7kfEU2L_D3QfhVxIjrYr1VctwUWfylC7KlCc,6549
|
|
46
46
|
crosshair/_mark_stacks.h,sha256=j86qubOUvVhoR19d74iQ084RrTEq8M6oT4wJsGQUySY,28678
|
|
47
47
|
crosshair/fuzz_core_test.py,sha256=q7WsZt6bj5OJrXaVsT3JaRYWWnL8X_1flSfty4Z7CcA,16903
|
|
@@ -108,7 +108,7 @@ crosshair/libimpl/binascii_test.py,sha256=LOBqLAJ77Kx8vorjVTaT3X0Z93zw4P5BvwUapM
|
|
|
108
108
|
crosshair/libimpl/collectionslib_test.py,sha256=3h7XTToKWauMhjrEwLXVI0jT8FZKBlkvlw0oiPMmuKM,9164
|
|
109
109
|
crosshair/libimpl/timelib.py,sha256=MXEFOZjFGa1-yLvmB3l3DFTLF9PSluOlmRK-ZJaA_oI,2409
|
|
110
110
|
crosshair/libimpl/jsonlib_test.py,sha256=U40WJf-69dtflz75sIsl5zA3IV5R6Ltc4Z9jv_Fh-Fw,1382
|
|
111
|
-
crosshair/libimpl/builtinslib.py,sha256=
|
|
111
|
+
crosshair/libimpl/builtinslib.py,sha256=UU2WDnQbPQMIETjvKfJlDXAFYyAXcRVvGt4SFYs-Jgk,171663
|
|
112
112
|
crosshair/libimpl/mathlib_test.py,sha256=QShLCXHdv3tx5PQxcSoR0MHeZ1huaiV6d3u7C2mGOn4,1861
|
|
113
113
|
crosshair/libimpl/fractionlib.py,sha256=qdbiAHHC480YdKq3wYK_piZ3UD7oT64YfuNclypMUfQ,458
|
|
114
114
|
crosshair/libimpl/binascii_ch_test.py,sha256=hFqSfF1Q8jl2LNBIWaQ6vBJIIshPOmSwrR0T1Ko4Leo,1009
|
|
@@ -137,7 +137,7 @@ crosshair/libimpl/itertoolslib.py,sha256=1bwV8voMV2j18KjXYMKkuNSC8p4VE_ZvY-74rAb
|
|
|
137
137
|
crosshair/libimpl/importliblib.py,sha256=GphQk86LcIpYWa81CIPDWbcmwU9Jo1utKAe4y3HMxYE,621
|
|
138
138
|
crosshair/libimpl/mathlib_ch_test.py,sha256=V-44I-qORpF4vP-z9z25MaVc4I5boW2vjud-sKkYYSE,1269
|
|
139
139
|
crosshair/libimpl/decimallib_ch_test.py,sha256=FVCY4KB8lJWeRKnz8txNkEc1te4QRKQYJtvXDuWfzPk,2380
|
|
140
|
-
crosshair/libimpl/fractionlib_test.py,sha256=
|
|
140
|
+
crosshair/libimpl/fractionlib_test.py,sha256=g7uNHTfzDebyc-SgH_4ziUAz7rJLZlHGZmPpny2P6hs,2357
|
|
141
141
|
crosshair/libimpl/codecslib_test.py,sha256=8K64njhxnTe7qLh-_onARNsm_qSG7BWM5dXgADYi54A,2536
|
|
142
142
|
crosshair/libimpl/jsonlib_ch_test.py,sha256=lLGnFq6Ti7l6aV_jDz-HEzKaPy5TIj_JA0sSnfI0Psc,1267
|
|
143
143
|
crosshair/libimpl/iolib_test.py,sha256=VJRSQ3nnROfXvtqdy3yLx3eYmIh31qSmeuAiIa7ywKU,667
|
|
@@ -167,9 +167,9 @@ crosshair/libimpl/encodings/ascii.py,sha256=Cz1xraTkXdQ5aBKDkorX4rAvrmf877_EqzC9
|
|
|
167
167
|
crosshair/libimpl/encodings/__init__.py,sha256=5LTEj1M-S00eZ4rfQWczAixg57vyh_9vZ5m5EKB5Ksc,680
|
|
168
168
|
crosshair/libimpl/encodings/latin_1.py,sha256=ftUsPjUb9L7UKXKi9P7OAqOl9FkNP98M9jMAvseXBCQ,1242
|
|
169
169
|
crosshair/libimpl/encodings/_encutil.py,sha256=nwVWqcGM1f7-hAC3Z46KnfrLzAjhfy4zaTa11uVBk6M,6828
|
|
170
|
-
crosshair_tool-0.0.
|
|
171
|
-
crosshair_tool-0.0.
|
|
172
|
-
crosshair_tool-0.0.
|
|
173
|
-
crosshair_tool-0.0.
|
|
174
|
-
crosshair_tool-0.0.
|
|
175
|
-
crosshair_tool-0.0.
|
|
170
|
+
crosshair_tool-0.0.93.dist-info/RECORD,,
|
|
171
|
+
crosshair_tool-0.0.93.dist-info/WHEEL,sha256=aNQV8Up4rZuRmZ4dQF1gRf2_E64p7eyxNGuFzXK-F6k,137
|
|
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/METADATA,sha256=EYRE-NAWbA23Od5TfsbHDQ_R70UNonJPNCdNawPlT-c,6777
|
|
175
|
+
crosshair_tool-0.0.93.dist-info/licenses/LICENSE,sha256=NVyMvNqn1pH6RSHs6RWRcJyJvORnpgGFBlF73buqYJ0,4459
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|