~ubuntu-branches/ubuntu/oneiric/swig1.3/oneiric

« back to all changes in this revision

Viewing changes to Lib/python/pyrun.swg

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2008-06-20 18:33:37 UTC
  • mfrom: (1.2.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20080620183337-hockvwcewu29409c
Tags: 1.3.35-4ubuntu1
* Merge from debian unstable, remaining changes:
  - Drop support for pike.
  - Use python2.5 instead of python2.4.
  - use php5
  - Clean Runtime/ as well.
  - Force a few environment variables.
  - debian/Rules (clean): Remove Lib/ocaml/swigp4.ml.

Show diffs side-by-side

added added

removed removed

Lines of Context:
448
448
{
449
449
  PySwigObject *sobj = (PySwigObject *) v;
450
450
  PyObject *next = sobj->next;
451
 
  if (sobj->own) {
 
451
  if (sobj->own == SWIG_POINTER_OWN) {
452
452
    swig_type_info *ty = sobj->ty;
453
453
    PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
454
454
    PyObject *destroy = data ? data->destroy : 0;
466
466
        res = ((*meth)(mself, v));
467
467
      }
468
468
      Py_XDECREF(res);
469
 
    } else {
 
469
    } 
 
470
#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
 
471
    else {
470
472
      const char *name = SWIG_TypePrettyName(ty);
471
 
#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
472
 
      printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name);
 
473
      printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
 
474
    }
473
475
#endif
474
 
    }
475
476
  } 
476
477
  Py_XDECREF(next);
477
478
  PyObject_DEL(v);
976
977
 
977
978
SWIGRUNTIME int
978
979
SWIG_Python_AcquirePtr(PyObject *obj, int own) {
979
 
  if (own) {
 
980
  if (own == SWIG_POINTER_OWN) {
980
981
    PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
981
982
    if (sobj) {
982
983
      int oldown = sobj->own;
997
998
    return SWIG_OK;
998
999
  } else {
999
1000
    PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
 
1001
    if (own)
 
1002
      *own = 0;
1000
1003
    while (sobj) {
1001
1004
      void *vptr = sobj->ptr;
1002
1005
      if (ty) {
1010
1013
          if (!tc) {
1011
1014
            sobj = (PySwigObject *)sobj->next;
1012
1015
          } else {
1013
 
            if (ptr) *ptr = SWIG_TypeCast(tc,vptr);
 
1016
            if (ptr) {
 
1017
              int newmemory = 0;
 
1018
              *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
 
1019
              if (newmemory == SWIG_CAST_NEW_MEMORY) {
 
1020
                assert(own);
 
1021
                if (own)
 
1022
                  *own = *own | SWIG_CAST_NEW_MEMORY;
 
1023
              }
 
1024
            }
1014
1025
            break;
1015
1026
          }
1016
1027
        }
1020
1031
      }
1021
1032
    }
1022
1033
    if (sobj) {
1023
 
      if (own) *own = sobj->own;
 
1034
      if (own)
 
1035
        *own = *own | sobj->own;
1024
1036
      if (flags & SWIG_POINTER_DISOWN) {
1025
1037
        sobj->own = 0;
1026
1038
      }
1085
1097
    }
1086
1098
    if (ty) {
1087
1099
      swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
1088
 
      if (!tc) return SWIG_ERROR;
1089
 
      *ptr = SWIG_TypeCast(tc,vptr);
 
1100
      if (tc) {
 
1101
        int newmemory = 0;
 
1102
        *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
 
1103
        assert(!newmemory); /* newmemory handling not yet implemented */
 
1104
      } else {
 
1105
        return SWIG_ERROR;
 
1106
      }
1090
1107
    } else {
1091
1108
      *ptr = vptr;
1092
1109
    }