ó
®â0_c           @   s*   d  d l  m Z d e f d „  ƒ  YZ d S(   iÿÿÿÿ(   t   c_void_pt   CPointerBasec           B   sP   e  Z d  Z d Z e Z d Z e Z	 e
 d „  ƒ Z e j d „  ƒ Z d „  Z RS(   sz   
    Base class for objects that have a pointer access property
    that controls access to the underlying C pointer.
    c         C   s-   |  j  r |  j  S|  j d |  j j ƒ ‚ d  S(   Ns   NULL %s pointer encountered.(   t   _ptrt   null_ptr_exception_classt	   __class__t   __name__(   t   self(    (    s8   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/ptr.pyt   ptr   s    	c         C   sD   | d  k p t | |  j ƒ s7 t d t | ƒ ƒ ‚ n  | |  _ d  S(   Ns   Incompatible pointer type: %s.(   t   Nonet
   isinstancet   ptr_typet	   TypeErrort   typeR   (   R   R   (    (    s8   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/ptr.pyR      s    c         C   sG   |  j  rC |  j rC y |  j  |  j ƒ WqC t t f k
 r? qC Xn  d S(   s9   
        Free the memory used by the C++ object.
        N(   t
   destructorR   R   t   AttributeErrorR   (   R   (    (    s8   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/ptr.pyt   __del__   s
    N(   R   t
   __module__t   __doc__R   R   R    R
   R   R   R   t   propertyR   t   setterR   (    (    (    s8   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/ptr.pyR      s   N(   t   ctypesR    t   objectR   (    (    (    s8   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/ptr.pyt   <module>   s   