MCPcopy Create free account
hub / github.com/ZeroIntensity/pointers.py / move

Method move

src/pointers/var_pointer.py:38–75  ·  view source on GitHub ↗
(
        self,
        target: Union[T, "BasePointer[T]"],
        *,
        unsafe: bool = False,
    )

Source from the content-addressed store, hash-verified

36
37 @handle
38 def move(
39 self,
40 target: Union[T, "BasePointer[T]"],
41 *,
42 unsafe: bool = False,
43 ) -> None:
44 if unsafe:
45 warnings.warn("unsafe has no effect on variable pointers")
46
47 if not self.name:
48 raise NullPointerError("pointer is NULL")
49
50 scope = self._get_scope()
51
52 if (scope is self._frame.f_locals) and (
53 self._frame.f_locals is not self._frame.f_globals
54 ):
55 force_update_locals(
56 self._frame,
57 self.name,
58 (
59 ~target
60 if isinstance(
61 target,
62 BasePointer,
63 )
64 else target
65 ),
66 )
67 else:
68 scope[self.name] = (
69 ~target
70 if isinstance(
71 target,
72 BasePointer,
73 )
74 else target
75 )
76
77 @property
78 def address(self) -> Optional[int]:

Callers

nothing calls this directly

Calls 3

_get_scopeMethod · 0.95
NullPointerErrorClass · 0.85
force_update_localsFunction · 0.85

Tested by

no test coverage detected