* 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.
This commit is contained in:
@@ -151,12 +151,10 @@ PyMODINIT_FUNC UnaryFunction1DVectorViewShape_Init( PyObject *module ) {
|
||||
|
||||
int UnaryFunction1DVectorViewShape___init__(BPy_UnaryFunction1DVectorViewShape* self, PyObject *args)
|
||||
{
|
||||
PyObject *obj;
|
||||
PyObject *obj = 0;
|
||||
|
||||
if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) {
|
||||
cout << "ERROR: UnaryFunction1DVectorViewShape___init__ " << endl;
|
||||
if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) )
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( !obj )
|
||||
self->uf1D_vectorviewshape = new UnaryFunction1D< std::vector<ViewShape*> >();
|
||||
|
||||
Reference in New Issue
Block a user