diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2009-08-03 18:38:15 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2009-08-03 18:38:15 +0400 |
commit | d4ff63fe20d912a72a7695852a204ab3f1d3dce7 (patch) | |
tree | 648f56790599a1ef9713ba56a08c85bdb6690ce9 /source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f | |
parent | e2eb4d567c27b0ea58dd6c1687dcd9538b64202e (diff) |
* Fixed uninitialized pointers in "__init__" methods of UnaryFunction1D types.
There was a known issue for a long time that we occasionally encountered
strange "TypeError: an integer is required" and "RuntimeWarning: tp_compare
didn't return -1 or -2 for exception", as shown in the following unit test
log. The source of the former error was PyInt_AsLong(obj) being used by
IntegrationType_from_BPy_IntegrationType(obj), where "obj" was not properly
initialized in "__init__" before the converter was called. The TypeError
was left unattended for a while and showed up when a comparison occurred
and the TypeError was detected, which resulted in the latter warning.
> runTest (__main__.UnaryFunction1DDoubleInitTestCase) ...
> .\blender:211: RuntimeWarning: tp_compare didn't return -1 or -2 for exception
> ERROR
>
> ======================================================================
> ERROR: runTest (__main__.UnaryFunction1DDoubleInitTestCase)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "init_tests.py", line 211, in runTest
> TypeError: an integer is required
>
> ----------------------------------------------------------------------
* Also removed unnecessary error messages in "__init__" methods of
UnaryFunction1D types.
Diffstat (limited to 'source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f')
2 files changed, 2 insertions, 6 deletions
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp index 2976ca213a5..4b8e5162408 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp @@ -104,10 +104,8 @@ int Normal2DF1D___init__( BPy_Normal2DF1D* self, PyObject *args) { PyObject *obj = 0; - if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) { - cout << "ERROR: Normal2DF1D___init__" << endl; + if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) return -1; - } IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; self->py_uf1D_vec2f.uf1D_vec2f = new Functions1D::Normal2DF1D(t); diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp index f2494af27e3..87dbef90c47 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp @@ -104,10 +104,8 @@ int Orientation2DF1D___init__( BPy_Orientation2DF1D* self, PyObject *args) { PyObject *obj = 0; - if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) { - cout << "ERROR: Orientation2DF1D___init__" << endl; + if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) return -1; - } IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; self->py_uf1D_vec2f.uf1D_vec2f = new Functions1D::Orientation2DF1D(t); |