Opened 12 years ago
Closed 12 years ago
#18640 closed Bug (fixed)
django.contrib.gis.gdal.DataSource fields give gibberish or segfault when accessed directly
Reported by: | YenTheFirst | Owned by: | jbronn |
---|---|---|---|
Component: | GIS | Version: | 1.4 |
Severity: | Release blocker | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
if you hold a feature in a variable, and access a field, it will give the correct value.
however, if you access a feature's field by layer[<index>][<field_name>], it gives gibberish, or a segfault.
this might be related to https://code.djangoproject.com/ticket/9448. however, given that the ticket was closed, it might be a different issue.
script to reproduce issue:
import os import django.contrib.gis from django.contrib.gis.gdal import DataSource GIS_PATH = os.path.dirname(django.contrib.gis.__file__) CITIES_PATH = os.path.join(GIS_PATH, 'tests/data/cities/cities.shp') ds = DataSource(CITIES_PATH) layer = ds[0] feature = layer[0] field = feature['Name'] print "this is valid: %r (%r)" % (field.value, list(field.value)) field = layer[0]['Name'] print "but this isn't: %r (%r)" % (field.value, list(field.value))
in python, results in segfault.
in ipython:
this is valid: 'Pueblo' (['P', 'u', 'e', 'b', 'l', 'o'])
but this isn't: ':\xd5\xe2=\xb1\xb4\xb9\xb4Q' ([':', '\xd5', '\xe2', '=', '\xb1', '\xb4', '\xb9', '\xb4', 'Q'])
saved as script, results in:
this is valid: 'Pueblo' (['P', 'u', 'e', 'b', 'l', 'o'])
but this isn't: ([])
this is on an ubuntu 11.04, with django 1.4, and gdal 1.7
Attachments (2)
Change History (6)
by , 12 years ago
Attachment: | 18640-1.diff added |
---|
comment:1 by , 12 years ago
Component: | Uncategorized → GIS |
---|---|
Has patch: | set |
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Bug |
Confirmed. It appears that it is the same type of issue as in #9448. At least, adding references to parent objects seems to solve the problem.
by , 12 years ago
Attachment: | 18640-2.diff added |
---|
comment:2 by , 12 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Yeah this is a problem. I've updated the implementation, but will need to review more when I get home from the sprints.
comment:3 by , 12 years ago
Severity: | Normal → Release blocker |
---|
comment:4 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Add parent references to GDAL Feature/Field