Source: wand
Version: 0.2.3-1
Severity: minor
Tags: patch
Error handling in Resource.resource setter is slightly broken:
import wand.image
wand.image.Image(width=1, height=1).resource = None
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/wand/resource.py", line 163, in resource
raise TypeError(repr(wand) + ' is an invalid resource')
NameError: global name 'wand' is not defined
Please see the attached patch for the fix.
--
Jakub Wilk
diff --git a/wand/resource.py b/wand/resource.py
--- a/wand/resource.py
+++ b/wand/resource.py
@@ -159,9 +159,9 @@
def resource(self, resource):
if self.c_is_resource(resource):
self.c_resource = resource
else:
- raise TypeError(repr(wand) + ' is an invalid resource')
+ raise TypeError(repr(resource) + ' is an invalid resource')
increment_refcount()
@resource.deleter
def resource(self):