Changeset 9e6695d


Ignore:
Timestamp:
Mar 8, 2013, 3:52:01 AM (11 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
1ee4033
Parents:
90a8f2f
Message:

python/: use Py_RETURN_NONE, fixing a memory bug triggered after opening many sinks

Location:
python
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • python/ext/aubiomodule.c

    r90a8f2f r9e6695d  
    165165
    166166  // since this function does not return, we could return None
    167   //return Py_None;
     167  //Py_RETURN_NONE;
    168168  // however it is convenient to return the modified vector
    169169  return (PyObject *) PyAubio_CFvecToArray(vec);
  • python/ext/py-filter.c

    r90a8f2f r9e6695d  
    100100    return NULL;
    101101  }
    102   return Py_None;
     102  Py_RETURN_NONE;
    103103}
    104104
     
    118118    return NULL;
    119119  }
    120   return Py_None;
     120  Py_RETURN_NONE;
    121121}
    122122
     
    136136    return NULL;
    137137  }
    138   return Py_None;
     138  Py_RETURN_NONE;
    139139}
    140140
  • python/ext/py-filterbank.c

    r90a8f2f r9e6695d  
    110110    return NULL;
    111111  }
    112   return Py_None;
     112  Py_RETURN_NONE;
    113113}
    114114
     
    129129    return NULL;
    130130  }
    131   return Py_None;
     131  Py_RETURN_NONE;
    132132}
    133133
     
    159159    return NULL;
    160160  }
    161   return Py_None;
     161  Py_RETURN_NONE;
    162162}
    163163
  • python/gen_pyobject.py

    r90a8f2f r9e6695d  
    343343      returnval += "  return (PyObject *)" + aubiovectopyobj[p['type']] + " (" + p['name'] + ")"
    344344  else:
    345     returnval = "  return Py_None;";
     345    returnval += "  Py_RETURN_NONE"
    346346  # end of output strings
    347347  return outputvecs, outputcreate, returnval
     
    474474    return NULL;
    475475  }
    476   return Py_None;
     476  Py_RETURN_NONE;
    477477}
    478478""" % {'funcname': method_name, 'objname': name,
  • python/tests/test_sink.py

    r90a8f2f r9e6695d  
    1313    def setUp(self):
    1414        if not len(list_of_sounds): self.skipTest('add some sound files in \'python/tests/sounds\'')
     15
     16    def test_many_sinks(self):
     17        for i in range(100):
     18            g = sink('/tmp/f.wav', 0)
     19            write = 256
     20            for n in range(200):
     21                vec = fvec(write)
     22                g(vec, write)
     23            del g
    1524
    1625    def test_read(self):
     
    3140                print "from", f.uri,
    3241                print "to", g.uri
     42                #del f, g
    3343
    3444if __name__ == '__main__':
    35   from unittest import main
    36   main()
    37 
     45    from unittest import main
     46    main()
Note: See TracChangeset for help on using the changeset viewer.