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_CurvePointIterator.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_CurvePointIterator.cpp')
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp
index 1655b766a6b..0329aa99acc 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp
@@ -97,8 +97,10 @@ PyDoc_STRVAR(CurvePointIterator_object_doc,
static PyObject *CurvePointIterator_object_get(BPy_CurvePointIterator *self, void *UNUSED(closure))
{
- if (self->cp_it->isEnd())
- Py_RETURN_NONE;
+ if (self->cp_it->isEnd()) {
+ PyErr_SetString(PyExc_RuntimeError, "iteration has stopped");
+ return NULL;
+ }
return BPy_CurvePoint_from_CurvePoint(self->cp_it->operator*());
}