diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2009-10-20 15:34:18 -0300 |
---|---|---|
committer | Marcelo Lira <marcelo.lira@openbossa.org> | 2009-10-20 15:34:18 -0300 |
commit | a1ea10151397cefd86aa0f6c4822932d2cc6a601 (patch) | |
tree | 72a43ad326839a1c56217b893f999c28ad0c30f3 /tests/samplebinding/simplefile_glue.cpp | |
parent | 0953187f7b13b8ca410c8db8fa856154cc6729a8 (diff) |
added the SimpleFile class to the sample library to check how a
method returning a boolean value that indicates success/failure
on a IO operation could be modified to express the any occurring
problems as Python exceptions (in this case IOError);
the generator was changed to return a 'None' value for Python
callers on methods that had it's return value removed
Diffstat (limited to 'tests/samplebinding/simplefile_glue.cpp')
-rw-r--r-- | tests/samplebinding/simplefile_glue.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/samplebinding/simplefile_glue.cpp b/tests/samplebinding/simplefile_glue.cpp new file mode 100644 index 000000000..118ec945c --- /dev/null +++ b/tests/samplebinding/simplefile_glue.cpp @@ -0,0 +1,8 @@ +// native ending +if (%0 == Py_False) { + PyObject* error_msg = PyString_FromFormat( + "Could not open file: \"%s\"", PySimpleFile_cptr(self)->filename()); + PyErr_SetObject(PyExc_IOError, error_msg); + return 0; +} + |