(
self,
data: Union[BasePointer[T], T],
unsafe: bool = False,
)
| 380 | |
| 381 | @handle |
| 382 | def move( |
| 383 | self, |
| 384 | data: Union[BasePointer[T], T], |
| 385 | unsafe: bool = False, |
| 386 | ) -> None: |
| 387 | add_ref(data) |
| 388 | self.ensure_valid() |
| 389 | from .object_pointer import to_ptr |
| 390 | |
| 391 | data_ptr = data if isinstance(data, BasePointer) else to_ptr(data) |
| 392 | |
| 393 | if (sys.version_info.minor >= 11) and (gc.is_tracked(~data_ptr)): |
| 394 | remove_ref(data) |
| 395 | raise RuntimeError("allocation on tracked types is not supported on 3.11+") |
| 396 | |
| 397 | |
| 398 | ptr, byte_stream = self._make_stream_and_ptr( |
| 399 | sys.getsizeof(~data_ptr), |
| 400 | data_ptr.ensure(), |
| 401 | ) |
| 402 | |
| 403 | move_to_mem(ptr, byte_stream, unsafe=unsafe) |
| 404 | self.assigned = True |
| 405 | remove_ref(data) |
| 406 | |
| 407 | @handle |
| 408 | def dereference(self) -> T: |
nothing calls this directly
no test coverage detected