MCPcopy Create free account
hub / github.com/Kitware/VTK / PyVTKObject_New

Function PyVTKObject_New

Wrapping/PythonCore/PyVTKObject.cxx:292–316  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

290
291//------------------------------------------------------------------------------
292PyObject* PyVTKObject_New(PyTypeObject* tp, PyObject* args, PyObject* /*kwds*/)
293{
294 // XXX(python3-abi3): all types will be heap types in abi3
295 // If type was subclassed within python, then skip arg checks and
296 // simply create a new object.
297 PyObject* o = nullptr;
298 if ((PyType_GetFlags(tp) & Py_TPFLAGS_HEAPTYPE) == 0)
299 {
300 if (!PyArg_UnpackTuple(args, vtkPythonUtil::GetTypeName(tp), 0, 1, &o))
301 {
302 return nullptr;
303 }
304
305 if (o)
306 {
307 // used to create a VTK object from a SWIG pointer
308 return vtkPythonUtil::GetObjectFromObject(o, vtkPythonUtil::StripModuleFromType(tp));
309 }
310 }
311
312 // if PyVTKObject_FromPointer gets nullptr, it creates a new object.
313 o = PyVTKObject_FromPointer(tp, nullptr, nullptr);
314
315 return o;
316}
317
318//------------------------------------------------------------------------------
319int PyVTKObject_Init(PyObject* obj, PyObject* /*args*/, PyObject* kwds)

Callers

nothing calls this directly

Calls 1

PyVTKObject_FromPointerFunction · 0.85

Tested by

no test coverage detected