Code

Opened 4 years ago

Closed 4 years ago

Last modified 4 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: UI/UX:

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?

Attachments (0)

Change History (3)

comment:1 Changed 4 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 4 years ago by jbronn

  • Resolution set to fixed
  • Status changed from new to closed

(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 Changed 4 years ago by jbronn

(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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.