Permalink
Browse files

Clear exceptions if PyFile_Dup() fails -- we have a way to handle "no…

…n-real" file objects.
  • Loading branch information...
1 parent 889951e commit cd6c8c932ea3fc768b145a9ad053bf05b2f1b62d @mdboom committed Jan 11, 2013
Showing with 2 additions and 0 deletions.
  1. +2 −0 src/_png.cpp
View
@@ -149,6 +149,7 @@ Py::Object _png_module::write_png(const Py::Tuple& args)
}
else
{
+ PyErr_Clear();
PyObject* write_method = PyObject_GetAttrString(
py_file, "write");
if (!(write_method && PyCallable_Check(write_method)))
@@ -326,6 +327,7 @@ _png_module::_read_png(const Py::Object& py_fileobj, const bool float_result,
}
else
{
+ PyErr_Clear();
PyObject* read_method = PyObject_GetAttrString(py_file, "read");
if (!(read_method && PyCallable_Check(read_method)))
{

0 comments on commit cd6c8c9

Please sign in to comment.