3
©ôÁg	  ã               @   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 | jd| jj ƒ‚d S )NzNULL %s pointer encountered.)Ú_ptrÚnull_ptr_exception_classÚ	__class__Ú__name__)Úself© r	   úT/var/www/tester-filtro-web/env/lib/python3.6/site-packages/django/contrib/gis/ptr.pyÚptr   s    zCPointerBase.ptrc             C   s.   |d kp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 r8| jr8y| j | jƒ W n tttfk
r6   Y nX dS )z9
        Free the memory used by the C++ object.
        N)Ú
destructorr   r   ÚAttributeErrorÚImportErrorr   )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   