a
    wh                      @   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
   P/var/www/battlenet.uz/venv/lib/python3.9/site-packages/django/contrib/gis/ptr.pyptr   s
    
zCPointerBase.ptrc                 C   s.   |d u 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r6z|  | j W n tttfy4   Y n0 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   