Args: address: Address of the underlying value. increment_ref: Should the reference count on the target object get incremented.
(
self,
address: Optional[int],
increment_ref: bool = False,
)
| 181 | """Abstract class for a pointer to a Python object.""" |
| 182 | |
| 183 | def __init__( |
| 184 | self, |
| 185 | address: Optional[int], |
| 186 | increment_ref: bool = False, |
| 187 | ) -> None: |
| 188 | """ |
| 189 | Args: |
| 190 | address: Address of the underlying value. |
| 191 | increment_ref: Should the reference count on the target object get incremented. |
| 192 | """ # noqa |
| 193 | self._address: Optional[int] = address |
| 194 | |
| 195 | if increment_ref and address: |
| 196 | add_ref(~self) |
| 197 | |
| 198 | self._origin_size = sys.getsizeof(~self if address else None) |
| 199 | weakref.finalize(self, self._cleanup) |
| 200 | |
| 201 | @handle |
| 202 | def set_attr(self, key: str, value: Any) -> None: |