Dereference the pointer.
(self)
| 173 | |
| 174 | @handle |
| 175 | def dereference(self) -> T: |
| 176 | """Dereference the pointer.""" |
| 177 | ctype = get_mapped(self.type) |
| 178 | |
| 179 | if (ctype is ctypes.c_char_p) and (self.alt): |
| 180 | res = ctypes.c_char_p(self.ensure()).value |
| 181 | return res # type: ignore |
| 182 | |
| 183 | ptr = ( |
| 184 | ctype.from_address(self.ensure()) |
| 185 | if not self._void_p |
| 186 | else ctypes.cast( |
| 187 | ctypes.c_void_p(self.address), ctypes.POINTER(ctype) |
| 188 | ) # fmt: off |
| 189 | ) |
| 190 | return ptr.value if not self._void_p else ptr.contents.value # type: ignore # noqa |
| 191 | |
| 192 | def __iter__(self) -> Iterator[T]: |
| 193 | """Dereference the pointer.""" |
no test coverage detected