crosshair-tool 0.0.94__cp312-cp312-macosx_11_0_arm64.whl → 0.0.95__cp312-cp312-macosx_11_0_arm64.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.

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.94" # Do not forget to update in setup.py!
18
+ __version__ = "0.0.95" # Do not forget to update in setup.py!
19
19
  __author__ = "Phillip Schanely"
20
20
  __license__ = "MIT"
21
21
  __status__ = "Alpha"
@@ -2611,18 +2611,6 @@ class SymbolicObject(ObjectProxy, CrossHairValue, Untracable):
2611
2611
  return object()
2612
2612
  return proxy_for_type(pytype, varname, allow_subtypes=False)
2613
2613
 
2614
- def _wrapped(self):
2615
- with NoTracing():
2616
- inner = _MISSING
2617
- try:
2618
- inner = object.__getattribute__(self, "_inner")
2619
- except AttributeError:
2620
- pass
2621
- if inner is _MISSING:
2622
- inner = self._realize()
2623
- object.__setattr__(self, "_inner", inner)
2624
- return inner
2625
-
2626
2614
  def __ch_realize__(self):
2627
2615
  return realize(self._wrapped())
2628
2616
 
crosshair/objectproxy.py CHANGED
@@ -10,11 +10,36 @@ from crosshair.tracers import NoTracing
10
10
  # (which is BSD licenced)
11
11
  #
12
12
 
13
+ _MISSING = object()
14
+
15
+
16
+ def proxy_inplace_op(proxy, op, *args):
17
+ my_original_value = proxy._wrapped()
18
+ my_new_value = op(my_original_value, *args)
19
+ # We need to return our own identity if (and only if!) the underlying value does.
20
+ if my_new_value is my_original_value:
21
+ return proxy
22
+ else:
23
+ object.__setattr__(proxy, "_inner", my_new_value)
24
+ return my_new_value
25
+
13
26
 
14
27
  class ObjectProxy:
15
- def _wrapped(self):
28
+ def _realize(self):
16
29
  raise NotImplementedError
17
30
 
31
+ def _wrapped(self):
32
+ with NoTracing():
33
+ inner = _MISSING
34
+ try:
35
+ inner = object.__getattribute__(self, "_inner")
36
+ except AttributeError:
37
+ pass
38
+ if inner is _MISSING:
39
+ inner = self._realize()
40
+ object.__setattr__(self, "_inner", inner)
41
+ return inner
42
+
18
43
  def __get_module__(self) -> str:
19
44
  return self._wrapped().__module__
20
45
 
@@ -233,40 +258,40 @@ class ObjectProxy:
233
258
  return other | self._wrapped()
234
259
 
235
260
  def __iadd__(self, other):
236
- return operator.iadd(self._wrapped(), other)
261
+ return proxy_inplace_op(self, operator.iadd, other)
237
262
 
238
263
  def __isub__(self, other):
239
- return operator.isub(self._wrapped(), other)
264
+ return proxy_inplace_op(self, operator.isub, other)
240
265
 
241
266
  def __imul__(self, other):
242
- return operator.imul(self._wrapped(), other)
267
+ return proxy_inplace_op(self, operator.imul, other)
243
268
 
244
269
  def __itruediv__(self, other):
245
- return operator.itruediv(self._wrapped(), other)
270
+ return proxy_inplace_op(self, operator.itruediv, other)
246
271
 
247
272
  def __ifloordiv__(self, other):
248
- return operator.iflootdiv(self._wrapped(), other)
273
+ return proxy_inplace_op(self, operator.ifloordiv, other)
249
274
 
250
275
  def __imod__(self, other):
251
- return operator.imod(self._wrapped(), other)
276
+ return proxy_inplace_op(self, operator.imod, other)
252
277
 
253
278
  def __ipow__(self, other, *args):
254
- return operator.ipow(self._wrapped(), other, *args)
279
+ return proxy_inplace_op(self, operator.ipow, other, *args)
255
280
 
256
281
  def __ilshift__(self, other):
257
- return operator.ilshift(self._wrapped(), other)
282
+ return proxy_inplace_op(self, operator.ilshift, other)
258
283
 
259
284
  def __irshift__(self, other):
260
- return operator.irshift(self._wrapped(), other)
285
+ return proxy_inplace_op(self, operator.irshift, other)
261
286
 
262
287
  def __iand__(self, other):
263
- return operator.iand(self._wrapped(), other)
288
+ return proxy_inplace_op(self, operator.iand, other)
264
289
 
265
290
  def __ixor__(self, other):
266
- return operator.ixor(self._wrapped(), other)
291
+ return proxy_inplace_op(self, operator.ixor, other)
267
292
 
268
293
  def __ior__(self, other):
269
- return operator.ior(self._wrapped(), other)
294
+ return proxy_inplace_op(self, operator.ior, other)
270
295
 
271
296
  def __neg__(self):
272
297
  return -self._wrapped()
@@ -7,12 +7,12 @@ class ObjectWrap(ObjectProxy):
7
7
  def __init__(self, obj):
8
8
  object.__setattr__(self, "_o", obj)
9
9
 
10
- def _wrapped(self):
10
+ def _realize(self):
11
11
  return object.__getattribute__(self, "_o")
12
12
 
13
13
 
14
14
  class TestObjectProxy:
15
- def test_object_proxy(self) -> None:
15
+ def test_object_proxy_over_list(self) -> None:
16
16
  i = [1, 2, 3]
17
17
  proxy = ObjectWrap(i)
18
18
  assert i == proxy
@@ -21,3 +21,21 @@ class TestObjectProxy:
21
21
  assert [1, 2, 3, 4, 5] == proxy + [5]
22
22
  assert [2, 3] == proxy[1:3]
23
23
  assert [1, 2, 3, 4] == proxy
24
+
25
+ def test_inplace_identities(self) -> None:
26
+ proxy = ObjectWrap(3.0)
27
+ orig_proxy = proxy
28
+ proxy += 1.0
29
+ assert proxy is not orig_proxy
30
+ proxy = ObjectWrap([1, 2])
31
+ orig_proxy = proxy
32
+ proxy += [3, 4]
33
+ assert proxy is orig_proxy
34
+
35
+ def test_object_proxy_over_float(self) -> None:
36
+ proxy = ObjectWrap(4.5)
37
+ proxy //= 2.0
38
+ assert 2.0 == proxy
39
+ proxy = ObjectWrap(5.0)
40
+ proxy /= 2.0
41
+ assert 2.5 == proxy
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crosshair-tool
3
- Version: 0.0.94
3
+ Version: 0.0.95
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
@@ -1,12 +1,12 @@
1
- _crosshair_tracers.cpython-312-darwin.so,sha256=cMilaMmBt6Ot_3dRd4Be2AMBOvRTelNqfBFlXY5XCNY,57768
1
+ _crosshair_tracers.cpython-312-darwin.so,sha256=IPeoZOo5cQd8Zugs3LwhBCQGh4RFqrlG2gAFYXc6lig,57768
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
5
5
  crosshair/lsp_server_test.py,sha256=7LO1Qqxkper3Xt2krgOlGqF1O_uDObo76o4FZbIqykY,969
6
6
  crosshair/conftest.py,sha256=BkLszApkdy6FrvzaHO7xh8_BJrG9AfytFTse-HuQVvg,653
7
7
  crosshair/copyext_test.py,sha256=uJzdC9m2FqMjqQ-ITFoP0MZg3OCiO8paU-d533KocD8,2108
8
- crosshair/objectproxy.py,sha256=Uc6mNkJBInvETGWBHI10GSNEIrBYDIxlAZ30M3PAIhQ,8935
9
- crosshair/objectproxy_test.py,sha256=KykRJLSHCDA7jb_XPBDhXHnS6Q1fG4oIJ579CeSEz3k,567
8
+ crosshair/objectproxy.py,sha256=1cO_ApA0AKPfCRu6MIsxUOKUUEGn0b1U4IHxTC4nDGI,9790
9
+ crosshair/objectproxy_test.py,sha256=UJuO_jUt8_OEUtgQWyhlekPOdvtM8IQ5M9I_1AqXPWM,1081
10
10
  crosshair/stubs_parser.py,sha256=rlBTQus5BlZ3Ygg6Xzk5dbQbDtRpv6w9i2HQmGrPVmc,14240
11
11
  crosshair/_preliminaries_test.py,sha256=r2PohNNMfIkDqsnvI6gKlJTbwBaZA9NQJueQfJMN2Eo,504
12
12
  crosshair/dynamic_typing_test.py,sha256=8p4NOJ6i9q9mozgCYlZP3VCs-TFMDaE_7W-TyNEse4o,5907
@@ -23,7 +23,7 @@ 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=5u1xF74Cj90mIqU71fUSrQIoexYRT3mwC7WOse0f2EQ,936
26
+ crosshair/__init__.py,sha256=nR2D8DuGMw_J17BMCTn9eHoipZzO7JmRusDfFoLt41k,936
27
27
  crosshair/core.py,sha256=7CHbmWvCVK2MlKXJUUe3eILPWGZniF8qXkBJNDkU4qg,64168
28
28
  crosshair/path_cover.py,sha256=wV0Vy8IPDzqXQ2VI8a94FxltS9p-Y1oF17OKePjvpgs,6710
29
29
  crosshair/enforce_test.py,sha256=C6CQ4P1FjkdIJeJg3aJynp1iLDCE6BFCEVtSqXbvmQk,4665
@@ -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=UU2WDnQbPQMIETjvKfJlDXAFYyAXcRVvGt4SFYs-Jgk,171663
111
+ crosshair/libimpl/builtinslib.py,sha256=Mr3bDiM6pQhLh5lkMoa4UYM3Hi4A_xm0dLteYCohZzQ,171289
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
@@ -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.94.dist-info/RECORD,,
171
- crosshair_tool-0.0.94.dist-info/WHEEL,sha256=V1loQ6TpxABu1APUg0MoTRBOzSKT5xVc3skizX-ovCU,136
172
- crosshair_tool-0.0.94.dist-info/entry_points.txt,sha256=u5FIPVn1jqn4Kzg5K_iNnbP6L4hQw5FWjQ0UMezG2VE,96
173
- crosshair_tool-0.0.94.dist-info/top_level.txt,sha256=2jLWtM-BWg_ZYNbNfrcds0HFZD62a6J7ZIbcgcQrRk4,29
174
- crosshair_tool-0.0.94.dist-info/METADATA,sha256=9HsWHsF3h7uXHcGzU3_HwaWWtHHRj-Ac6UbGXFL26DQ,6777
175
- crosshair_tool-0.0.94.dist-info/licenses/LICENSE,sha256=NVyMvNqn1pH6RSHs6RWRcJyJvORnpgGFBlF73buqYJ0,4459
170
+ crosshair_tool-0.0.95.dist-info/RECORD,,
171
+ crosshair_tool-0.0.95.dist-info/WHEEL,sha256=V1loQ6TpxABu1APUg0MoTRBOzSKT5xVc3skizX-ovCU,136
172
+ crosshair_tool-0.0.95.dist-info/entry_points.txt,sha256=u5FIPVn1jqn4Kzg5K_iNnbP6L4hQw5FWjQ0UMezG2VE,96
173
+ crosshair_tool-0.0.95.dist-info/top_level.txt,sha256=2jLWtM-BWg_ZYNbNfrcds0HFZD62a6J7ZIbcgcQrRk4,29
174
+ crosshair_tool-0.0.95.dist-info/METADATA,sha256=zJ6FZW9znhqPs1H19hgRsMBx3-OoGpaM2uc4TjqT0fQ,6777
175
+ crosshair_tool-0.0.95.dist-info/licenses/LICENSE,sha256=NVyMvNqn1pH6RSHs6RWRcJyJvORnpgGFBlF73buqYJ0,4459