MCPcopy Create free account
hub / github.com/chokkan/crfsuite / SWIG_Python_NewPointerObj

Function SWIG_Python_NewPointerObj

swig/python/export_wrap.cpp:2558–2607  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2556/* Create a new pointer object */
2557
2558SWIGRUNTIME PyObject *
2559SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) {
2560 SwigPyClientData *clientdata;
2561 PyObject * robj;
2562 int own;
2563
2564 if (!ptr)
2565 return SWIG_Py_Void();
2566
2567 clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0;
2568 own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
2569 if (clientdata && clientdata->pytype) {
2570 SwigPyObject *newobj;
2571 if (flags & SWIG_BUILTIN_TP_INIT) {
2572 newobj = (SwigPyObject*) self;
2573 if (newobj->ptr) {
2574 PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0);
2575 while (newobj->next)
2576 newobj = (SwigPyObject *) newobj->next;
2577 newobj->next = next_self;
2578 newobj = (SwigPyObject *)next_self;
2579 }
2580 } else {
2581 newobj = PyObject_New(SwigPyObject, clientdata->pytype);
2582 }
2583 if (newobj) {
2584 newobj->ptr = ptr;
2585 newobj->ty = type;
2586 newobj->own = own;
2587 newobj->next = 0;
2588#ifdef SWIGPYTHON_BUILTIN
2589 newobj->dict = 0;
2590#endif
2591 return (PyObject*) newobj;
2592 }
2593 return SWIG_Py_Void();
2594 }
2595
2596 assert(!(flags & SWIG_BUILTIN_TP_INIT));
2597
2598 robj = SwigPyObject_New(ptr, type, own);
2599 if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
2600 PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
2601 if (inst) {
2602 Py_DECREF(robj);
2603 robj = inst;
2604 }
2605 }
2606 return robj;
2607}
2608
2609/* Create a new packed object */
2610

Callers

nothing calls this directly

Calls 3

SWIG_Py_VoidFunction · 0.85
SwigPyObject_NewFunction · 0.85

Tested by

no test coverage detected