Thursday, September 3, 2020

Potential Bug in django.contrib.gis


Hi all,
I recently upgraded django 1.11 to 3.1. Now, in dango 3.1, the following example code from https://docs.djangoproject.com/en/3.1/ref/contrib/gis/geos/#django.contrib.gis.geos.Polygon
produces a Segfault.

Code snippet:
>>> from django.contrib.gis.geos import Point, LineString, Polygon, LinearRing
>>> ext_coords = ((0, 0), (0, 1), (1, 1), (1, 0), (0, 0))
>>> int_coords = ((0.4, 0.4), (0.4, 0.6), (0.6, 0.6), (0.6, 0.4), (0.4, 0.4))
>>> poly = Polygon(ext_coords, int_coords)
>>> [c for c in poly]
[<LinearRing object at 0x7f4796e4f9a0>, <LinearRing object at 0x7f4796e4f2b8>]
>>> [c for c in poly[0]]
Segmentation fault (core dumped)

I can also provoke this error with next():
>>> from django.contrib.gis.geos import Point, LineString, Polygon, LinearRing
>>> ext_coords = ((0, 0), (0, 1), (1, 1), (1, 0), (0, 0))
>>> int_coords = ((0.4, 0.4), (0.4, 0.6), (0.6, 0.6), (0.6, 0.4), (0.4, 0.4))
>>> poly = Polygon(ext_coords, int_coords)
>>> next(poly[0].__iter__())
Segmentation fault (core dumped)

Is this a bug or might there be another reason (e.g. hardware-related issue)?

Thanks,
Janis

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f204bcbb-fd18-44af-83de-917377b9d465n%40googlegroups.com.

No comments:

Post a Comment