Changeset 123


Ignore:
Timestamp:
03/25/06 16:21:54 (9 years ago)
Author:
xi
Message:

Fix a leak in _syckmodule.c (thanks, jbj)

Change the production status to Stable.

Location:
pysyck/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pysyck/trunk/ext/_syckmodule.c

    r49 r123  
    11021102        goto error; 
    11031103 
     1104    Py_DECREF(object); 
     1105 
    11041106    index = PyList_GET_SIZE(self->symbols); 
    11051107    PyGILState_Release(gs); 
     
    13211323 
    13221324    value = PyList_GetItem(self->symbols, index); 
     1325    Py_XINCREF(value); 
    13231326 
    13241327    Py_DECREF(self->symbols); 
  • pysyck/trunk/setup.py

    r65 r123  
    1515DOWNLOAD_URL = "http://pyyaml.org/download/pysyck/%s-%s.tar.gz" % (NAME, VERSION) 
    1616CLASSIFIERS = [ 
    17     "Development Status :: 3 - Alpha", 
     17    "Development Status :: 5 - Production/Stable", 
    1818    "Intended Audience :: Developers", 
    1919    "License :: OSI Approved :: BSD License", 
  • pysyck/trunk/tests/test_parser.py

    r23 r123  
    44import _syck 
    55 
    6 import StringIO, gc 
     6import StringIO, gc, sys 
    77 
    88EXAMPLE = """ 
     
    174174""" 
    175175 
     176LEAKS = """ 
     177- mere scalar 
     178- [ sequence, may, leak, too] 
     179- {"it's": mapping, with: many, potential: leaks} 
     180- {sequence: [], mapping: {}} 
     181""" 
     182 
    176183class TestAttributes(unittest.TestCase): 
    177184 
     
    372379        self.assert_(node.value[0] is node.value[1]) 
    373380 
     381class TestLeaks(unittest.TestCase): 
     382 
     383    def testLeaks(self): 
     384        parser = _syck.Parser(LEAKS) 
     385        node = parser.parse() 
     386        dummy = [] 
     387        self.checkLeaks(node, dummy) 
     388 
     389    def checkLeaks(self, node, dummy): 
     390        self.assertEqual(sys.getrefcount(node), sys.getrefcount(dummy)) 
     391        self.assertEqual(sys.getrefcount(node.value), 2) 
     392        dummy = [] 
     393        container = [dummy] 
     394        if isinstance(node, _syck.Seq): 
     395            for item in node.value: 
     396                self.checkLeaks(item, dummy) 
     397        elif isinstance(node, _syck.Map): 
     398            for key in node.value: 
     399                self.checkLeaks(key, dummy) 
     400                value = node.value[key] 
     401                self.checkLeaks(value, dummy) 
     402 
Note: See TracChangeset for help on using the changeset viewer.