(self, name: str)
| 122 | |
| 123 | @handle |
| 124 | def __getattribute__(self, name: str): |
| 125 | attr = super().__getattribute__(name) |
| 126 | |
| 127 | with suppress(AttributeError): |
| 128 | hints = super().__getattribute__("_hints") |
| 129 | |
| 130 | if (name in hints) and (type(attr)) is bytes: |
| 131 | attr = attempt_decode(attr) |
| 132 | |
| 133 | if isinstance(attr, ctypes._Pointer): # type: ignore |
| 134 | value = attr.contents |
| 135 | ct = type(value) |
| 136 | |
| 137 | if ct is ctypes.c_void_p: |
| 138 | add_ref(ct) |
| 139 | return VoidPointer( |
| 140 | ctypes.addressof(value), |
| 141 | ctypes.sizeof(value), |
| 142 | ) |
| 143 | |
| 144 | py_type = get_py(ct) |
| 145 | return TypedCPointer( |
| 146 | ctypes.addressof(value), |
| 147 | py_type, |
| 148 | ctypes.sizeof(value), |
| 149 | False, |
| 150 | ) |
| 151 | |
| 152 | if name in super().__getattribute__("_void_p"): |
| 153 | ct = ctypes.c_void_p(attr) # type: ignore |
| 154 | return VoidPointer(attr, ctypes.sizeof(ct)) # type: ignore |
| 155 | |
| 156 | return attr |
| 157 | |
| 158 | def __setattr__(self, name: str, value: Any): |
| 159 | if hasattr(self, "_struct"): |
nothing calls this directly
no test coverage detected