Home | History | Annotate | Download | only in Utility
      1 
      2 /////////////// CallNextTpDealloc.proto ///////////////
      3 
      4 static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc);
      5 
      6 /////////////// CallNextTpDealloc ///////////////
      7 
      8 static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc) {
      9     PyTypeObject* type = Py_TYPE(obj);
     10     /* try to find the first parent type that has a different tp_dealloc() function */
     11     while (type && type->tp_dealloc != current_tp_dealloc)
     12         type = type->tp_base;
     13     while (type && type->tp_dealloc == current_tp_dealloc)
     14         type = type->tp_base;
     15     if (type)
     16         type->tp_dealloc(obj);
     17 }
     18 
     19 /////////////// CallNextTpTraverse.proto ///////////////
     20 
     21 static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse);
     22 
     23 /////////////// CallNextTpTraverse ///////////////
     24 
     25 static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse) {
     26     PyTypeObject* type = Py_TYPE(obj);
     27     /* try to find the first parent type that has a different tp_traverse() function */
     28     while (type && type->tp_traverse != current_tp_traverse)
     29         type = type->tp_base;
     30     while (type && type->tp_traverse == current_tp_traverse)
     31         type = type->tp_base;
     32     if (type && type->tp_traverse)
     33         return type->tp_traverse(obj, v, a);
     34     // FIXME: really ignore?
     35     return 0;
     36 }
     37 
     38 /////////////// CallNextTpClear.proto ///////////////
     39 
     40 static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_dealloc);
     41 
     42 /////////////// CallNextTpClear ///////////////
     43 
     44 static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear) {
     45     PyTypeObject* type = Py_TYPE(obj);
     46     /* try to find the first parent type that has a different tp_clear() function */
     47     while (type && type->tp_clear != current_tp_clear)
     48         type = type->tp_base;
     49     while (type && type->tp_clear == current_tp_clear)
     50         type = type->tp_base;
     51     if (type && type->tp_clear)
     52         type->tp_clear(obj);
     53 }
     54