MCPcopy Create free account
hub / github.com/cvxpy/cvxpy / SWIG_Python_NewShadowInstance

Function SWIG_Python_NewShadowInstance

cvxpy/cvxcore/python/cvxcore_wrap.cxx:2695–2759  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2693*/
2694
2695SWIGRUNTIME PyObject*
2696SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
2697{
2698 PyObject *inst = 0;
2699 PyObject *newraw = data->newraw;
2700 if (newraw) {
2701 inst = PyObject_Call(newraw, data->newargs, NULL);
2702 if (inst) {
2703#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2704 PyObject **dictptr = _PyObject_GetDictPtr(inst);
2705 if (dictptr != NULL) {
2706 PyObject *dict = *dictptr;
2707 if (dict == NULL) {
2708 dict = PyDict_New();
2709 *dictptr = dict;
2710 }
2711 if (dict) {
2712 PyDict_SetItem(dict, SWIG_This(), swig_this);
2713 } else{
2714 Py_DECREF(inst);
2715 inst = 0;
2716 }
2717 }
2718#else
2719 if (PyObject_SetAttr(inst, SWIG_This(), swig_this) == -1) {
2720 Py_DECREF(inst);
2721 inst = 0;
2722 }
2723#endif
2724 }
2725 } else {
2726#if PY_VERSION_HEX >= 0x03000000
2727 PyObject *empty_args = PyTuple_New(0);
2728 if (empty_args) {
2729 PyObject *empty_kwargs = PyDict_New();
2730 if (empty_kwargs) {
2731#ifndef Py_LIMITED_API
2732 newfunc newfn = ((PyTypeObject *)data->newargs)->tp_new;
2733#else
2734 newfunc newfn = (newfunc)PyType_GetSlot((PyTypeObject *)data->newargs, Py_tp_new);
2735#endif
2736 inst = newfn((PyTypeObject *)data->newargs, empty_args, empty_kwargs);
2737 Py_DECREF(empty_kwargs);
2738 if (inst) {
2739 if (PyObject_SetAttr(inst, SWIG_This(), swig_this) == -1) {
2740 Py_DECREF(inst);
2741 inst = 0;
2742 } else {
2743 PyType_Modified(Py_TYPE(inst));
2744 }
2745 }
2746 }
2747 Py_DECREF(empty_args);
2748 }
2749#else
2750 PyObject *dict = PyDict_New();
2751 if (dict) {
2752 PyDict_SetItem(dict, SWIG_This(), swig_this);

Callers 1

Calls 1

SWIG_ThisFunction · 0.85

Tested by

no test coverage detected