diff --git a/django/contrib/gis/gdal/raster/band.py b/django/contrib/gis/gdal/raster/band.py
index f1eb50e..19f39e7 100644
a
|
b
|
|
| 1 | import weakref |
1 | 2 | from ctypes import byref, c_int |
2 | 3 | |
3 | 4 | from django.contrib.gis.gdal.base import GDALBase |
… |
… |
class GDALBand(GDALBase):
|
14 | 15 | Wraps a GDAL raster band, needs to be obtained from a GDALRaster object. |
15 | 16 | """ |
16 | 17 | def __init__(self, source, index): |
17 | | self.source = source |
| 18 | self.source = weakref.proxy(source) |
18 | 19 | self._ptr = capi.get_ds_raster_band(source._ptr, index) |
19 | 20 | |
20 | 21 | @property |
diff --git a/tests/gis_tests/gdal_tests/test_raster.py b/tests/gis_tests/gdal_tests/test_raster.py
index aabec06..057329e 100644
a
|
b
|
class GDALBandTests(unittest.TestCase):
|
275 | 275 | def setUp(self): |
276 | 276 | self.rs_path = os.path.join(os.path.dirname(upath(__file__)), |
277 | 277 | '../data/rasters/raster.tif') |
278 | | rs = GDALRaster(self.rs_path) |
279 | | self.band = rs.bands[0] |
| 278 | self.rs = GDALRaster(self.rs_path) |
| 279 | self.band = self.rs.bands[0] |
280 | 280 | |
281 | 281 | def test_band_data(self): |
282 | 282 | self.assertEqual(self.band.width, 163) |