diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-11-17 02:10:27 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-11-17 02:11:28 +0400 |
commit | c592ebf5df4a2be3b70bd3e2f2bba0e3d5908704 (patch) | |
tree | ead4bc3be3c83cfb68b19b1e476d7076d09ebce5 /source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp | |
parent | c239baa0badfdc0170159d2bd45c05618f6ed8f9 (diff) |
Freestyle: a follow-up fix of trunk revision 61233. When an iterator has reached
the end, any reference of the object pointed by it will now lead to a RuntimeError
instead of returning None, with the aim of forcing Python API users to check the
end of iteration rather than implicitly indicating the error condition.
Acknowledgement to flokkievids for API discussions in the BlenderArtists.org
Freestyle for Blender thread.
Diffstat (limited to 'source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp')
-rw-r--r-- | source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp index cbefcd3292e..12ca3d6cc4a 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp @@ -103,8 +103,10 @@ PyDoc_STRVAR(orientedViewEdgeIterator_object_doc, static PyObject *orientedViewEdgeIterator_object_get(BPy_orientedViewEdgeIterator *self, void *UNUSED(closure)) { - if (self->ove_it->isEnd()) - Py_RETURN_NONE; + if (self->ove_it->isEnd()) { + PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); + return NULL; + } return BPy_directedViewEdge_from_directedViewEdge(self->ove_it->operator*()); } |