summaryrefslogtreecommitdiffstats
path: root/libdimension-python
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2011-09-20 11:18:22 -0400
committerTavian Barnes <tavianator@gmail.com>2011-09-20 11:18:22 -0400
commitdf89a59c165e85114725983be6ba036d363c722a (patch)
tree091448e92acd2bee43306a9e03f06a2e7295cb4f /libdimension-python
parent2476507c0de2dee1aaf809d838dcd5406f09e34f (diff)
downloaddimension-df89a59c165e85114725983be6ba036d363c722a.tar.xz
Add a filename parameter to _raise_OSError().
Diffstat (limited to 'libdimension-python')
-rw-r--r--libdimension-python/dimension.pyx13
1 files changed, 8 insertions, 5 deletions
diff --git a/libdimension-python/dimension.pyx b/libdimension-python/dimension.pyx
index dffa8fa..0ab47a8 100644
--- a/libdimension-python/dimension.pyx
+++ b/libdimension-python/dimension.pyx
@@ -28,8 +28,11 @@ import os
# Helpers #
###########
-cdef _raise_OSError():
- raise OSError(errno, os.strerror(errno))
+cdef _raise_OSError(filename = None):
+ if filename is None:
+ raise OSError(errno, os.strerror(errno))
+ else:
+ raise OSError(errno, os.strerror(errno), filename)
###########
# Globals #
@@ -563,7 +566,7 @@ cdef class Canvas:
cdef char *cpath = bpath
cdef FILE *file = fopen(cpath, "wb")
if file == NULL:
- _raise_OSError()
+ _raise_OSError(path)
def finalize():
if fclose(file) != 0:
@@ -707,10 +710,10 @@ cdef class ImageMap(Pigment):
cdef char *cpath = bpath
cdef FILE *file = fopen(cpath, "rb")
if file == NULL:
- _raise_OSError()
+ _raise_OSError(path)
cdef dmnsn_canvas *canvas = dmnsn_png_read_canvas(file)
if canvas == NULL:
- _raise_OSError()
+ _raise_OSError(path)
if fclose(file) != 0:
_raise_OSError()