#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 , 16 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:2 by , 16 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:3 by , 16 years ago
Note:
See TracTickets
for help on using tickets.
(In [12905]) Fixed #13256 --
OGRGeometryno longer raises an exception when compared to instances of different types. Thanks, ninowalker for the bug report.