Raising proper ValueErrors

This commit is contained in:
wiredfool 2014-01-06 21:19:58 -08:00
parent 4cacfe6b11
commit 53ba63fcd5

View File

@ -61,7 +61,7 @@ class PyAccess(object):
:param xy: The pixel coordinate, given as (x, y). :param xy: The pixel coordinate, given as (x, y).
:param value: The pixel value. :param value: The pixel value.
""" """
if self.readonly: raise Exception('ValueError') # undone, ImagingError_ValueError if self.readonly: raise ValueError('Attempt to putpixel a read only image')
(x,y) = self.check_xy(xy) (x,y) = self.check_xy(xy)
return self.set_pixel(x,y,color) return self.set_pixel(x,y,color)
@ -83,8 +83,8 @@ class PyAccess(object):
def check_xy(self, xy): def check_xy(self, xy):
(x,y) = xy (x,y) = xy
if not (0 <= x < self.xsize and 0 <= y < self.ysize): if not (0 <= x < self.xsize and 0 <= y < self.ysize):
raise Exception('ValueError- pixel location out of range') #undone raise ValueError('pixel location out of range')
return (x,y) return xy
class _PyAccess32_3(PyAccess): class _PyAccess32_3(PyAccess):