| 2447 | */ |
| 2448 | |
| 2449 | SWIGRUNTIME PyObject* |
| 2450 | SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) |
| 2451 | { |
| 2452 | #if (PY_VERSION_HEX >= 0x02020000) |
| 2453 | PyObject *inst = 0; |
| 2454 | PyObject *newraw = data->newraw; |
| 2455 | if (newraw) { |
| 2456 | inst = PyObject_Call(newraw, data->newargs, NULL); |
| 2457 | if (inst) { |
| 2458 | #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) |
| 2459 | PyObject **dictptr = _PyObject_GetDictPtr(inst); |
| 2460 | if (dictptr != NULL) { |
| 2461 | PyObject *dict = *dictptr; |
| 2462 | if (dict == NULL) { |
| 2463 | dict = PyDict_New(); |
| 2464 | *dictptr = dict; |
| 2465 | PyDict_SetItem(dict, SWIG_This(), swig_this); |
| 2466 | } |
| 2467 | } |
| 2468 | #else |
| 2469 | PyObject *key = SWIG_This(); |
| 2470 | PyObject_SetAttr(inst, key, swig_this); |
| 2471 | #endif |
| 2472 | } |
| 2473 | } else { |
| 2474 | #if PY_VERSION_HEX >= 0x03000000 |
| 2475 | inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None); |
| 2476 | PyObject_SetAttr(inst, SWIG_This(), swig_this); |
| 2477 | Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; |
| 2478 | #else |
| 2479 | PyObject *dict = PyDict_New(); |
| 2480 | PyDict_SetItem(dict, SWIG_This(), swig_this); |
| 2481 | inst = PyInstance_NewRaw(data->newargs, dict); |
| 2482 | Py_DECREF(dict); |
| 2483 | #endif |
| 2484 | } |
| 2485 | return inst; |
| 2486 | #else |
| 2487 | #if (PY_VERSION_HEX >= 0x02010000) |
| 2488 | PyObject *inst; |
| 2489 | PyObject *dict = PyDict_New(); |
| 2490 | PyDict_SetItem(dict, SWIG_This(), swig_this); |
| 2491 | inst = PyInstance_NewRaw(data->newargs, dict); |
| 2492 | Py_DECREF(dict); |
| 2493 | return (PyObject *) inst; |
| 2494 | #else |
| 2495 | PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type); |
| 2496 | if (inst == NULL) { |
| 2497 | return NULL; |
| 2498 | } |
| 2499 | inst->in_class = (PyClassObject *)data->newargs; |
| 2500 | Py_INCREF(inst->in_class); |
| 2501 | inst->in_dict = PyDict_New(); |
| 2502 | if (inst->in_dict == NULL) { |
| 2503 | Py_DECREF(inst); |
| 2504 | return NULL; |
| 2505 | } |
| 2506 | #ifdef Py_TPFLAGS_HAVE_WEAKREFS |
no test coverage detected