Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-11-17 02:10:27 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-11-17 02:11:28 +0400
commitc592ebf5df4a2be3b70bd3e2f2bba0e3d5908704 (patch)
treeead4bc3be3c83cfb68b19b1e476d7076d09ebce5 /source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp
parentc239baa0badfdc0170159d2bd45c05618f6ed8f9 (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_ViewEdgeIterator.cpp')
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp
index c191a94f08d..87e05a790b4 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp
@@ -122,8 +122,10 @@ PyDoc_STRVAR(ViewEdgeIterator_object_doc,
static PyObject *ViewEdgeIterator_object_get(BPy_ViewEdgeIterator *self, void *UNUSED(closure))
{
- if (!self->ve_it->isEnd())
- Py_RETURN_NONE;
+ if (!self->ve_it->isEnd()) {
+ PyErr_SetString(PyExc_RuntimeError, "iteration has stopped");
+ return NULL;
+ }
ViewEdge *ve = self->ve_it->operator*();
if (ve)
return BPy_ViewEdge_from_ViewEdge(*ve);
@@ -140,7 +142,8 @@ static PyObject *ViewEdgeIterator_current_edge_get(BPy_ViewEdgeIterator *self, v
ViewEdge *ve = self->ve_it->getCurrentEdge();
if (ve)
return BPy_ViewEdge_from_ViewEdge(*ve);
- Py_RETURN_NONE;}
+ Py_RETURN_NONE;
+}
static int ViewEdgeIterator_current_edge_set(BPy_ViewEdgeIterator *self, PyObject *value, void *UNUSED(closure))
{