File: //usr/lib/python3/dist-packages/django/contrib/gis/__pycache__/ptr.cpython-310.pyc
o
���_ � @ s d dl mZ G dd� d�ZdS )� )�c_void_pc @ sB e Zd ZdZdZeZdZeZ e
dd� �Zejdd� �Zdd� Z
dS )�CPointerBasezz
Base class for objects that have a pointer access property
that controls access to the underlying C pointer.
Nc C s | j r| j S | �d| jj ��)NzNULL %s pointer encountered.)�_ptr�null_ptr_exception_class� __class__�__name__��self� r
�8/usr/lib/python3/dist-packages/django/contrib/gis/ptr.py�ptr s zCPointerBase.ptrc C s. |d u st || j�stdt|� ��|| _d S )NzIncompatible pointer type: %s.)�
isinstance�ptr_type� TypeError�typer )r r r
r
r r s
c
C sB | j r| jrz | � | j� W dS tttfy Y dS w dS dS )z9
Free the memory used by the C++ object.
N)�
destructorr r �AttributeError�ImportErrorr r r
r
r �__del__ s ��zCPointerBase.__del__)r �
__module__�__qualname__�__doc__r r r r r r �propertyr �setterr r
r
r
r r s
r N)�ctypesr r r
r
r
r �<module> s