B
    ¥0H[ü  ã               @   s   d dl mZ G dd„ dƒZdS )é    )Úc_void_pc               @   sB   e Zd ZdZdZeZdZeZ	e
dd„ ƒZejdd„ ƒZdd„ ZdS )Ú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| jj ¡‚d S )NzNULL %s pointer encountered.)Ú_ptrÚnull_ptr_exception_classÚ	__class__Ú__name__)Úself© r	   úZC:\Users\HIRONO~1\AppData\Local\Temp\pip-install-6bm3nxem\django\django\contrib\gis\ptr.pyÚptr   s    zCPointerBase.ptrc             C   s.   |d ks$t || jƒs$tdt|ƒ ƒ‚|| _d S )NzIncompatible pointer type: %s.)Ú
isinstanceÚptr_typeÚ	TypeErrorÚtyper   )r   r   r	   r	   r
   r      s    c          	   C   s:   | j r6| jr6y|   | j¡ W n ttfk
r4   Y nX dS )z9
        Free the memory used by the C++ object.
        N)Ú
destructorr   r   ÚAttributeErrorr   )r   r	   r	   r
   Ú__del__   s
    zCPointerBase.__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   