Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#13256 closed (fixed)

OGRGeometry equals throws exception when compared to None

Reported by: ninowalker Owned by: nobody
Component: GIS Version: 1.1
Severity: Keywords: GDAL
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The following generates an exception:

>>> from django.contrib.gis.gdal import OGRGeometry
>>> geom = OGRGeometry("POINT(0 0)")
>>> if geom == None:
...    print 1
... 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.6/site-packages/Django-1.1.1-py2.6.egg/django/contrib/gis/gdal/geometries.py", line 166, in __eq__
    return self.equals(other)
  File "/usr/local/lib/python2.6/site-packages/Django-1.1.1-py2.6.egg/django/contrib/gis/gdal/geometries.py", line 397, in equals
    return self._topology(capi.ogr_equals, other)
  File "/usr/local/lib/python2.6/site-packages/Django-1.1.1-py2.6.egg/django/contrib/gis/gdal/geometries.py", line 385, in _topology
    raise TypeError('Must use another OGRGeometry object for topology operations!')
TypeError: Must use another OGRGeometry object for topology operations!

Equals (and other predicate methods), should probably test for None before dispatching to the C bindings. No?

Change History (3)

comment:1 by Russell Keith-Magee, 15 years ago

Triage Stage: UnreviewedAccepted

comment:2 by jbronn, 15 years ago

Resolution: fixed
Status: newclosed

(In [12905]) Fixed #13256 -- OGRGeometry no longer raises an exception when compared to instances of different types. Thanks, ninowalker for the bug report.

comment:3 by jbronn, 15 years ago

(In [12906]) [1.1.X] Fixed #13256 -- OGRGeometry no longer raises an exception when compared to instances of different types. Thanks, ninowalker for the bug report.

Backport of r12905 from trunk.

Note: See TracTickets for help on using tickets.
Back to Top