Changeset 123
- Timestamp:
- 03/25/06 16:21:54 (3 years ago)
- Files:
-
- pysyck/trunk/ext/_syckmodule.c (modified) (2 diffs)
- pysyck/trunk/setup.py (modified) (1 diff)
- pysyck/trunk/tests/test_parser.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
pysyck/trunk/ext/_syckmodule.c
r49 r123 1102 1102 goto error; 1103 1103 1104 Py_DECREF(object); 1105 1104 1106 index = PyList_GET_SIZE(self->symbols); 1105 1107 PyGILState_Release(gs); … … 1321 1323 1322 1324 value = PyList_GetItem(self->symbols, index); 1325 Py_XINCREF(value); 1323 1326 1324 1327 Py_DECREF(self->symbols); pysyck/trunk/setup.py
r65 r123 15 15 DOWNLOAD_URL = "http://pyyaml.org/download/pysyck/%s-%s.tar.gz" % (NAME, VERSION) 16 16 CLASSIFIERS = [ 17 "Development Status :: 3 - Alpha",17 "Development Status :: 5 - Production/Stable", 18 18 "Intended Audience :: Developers", 19 19 "License :: OSI Approved :: BSD License", pysyck/trunk/tests/test_parser.py
r23 r123 4 4 import _syck 5 5 6 import StringIO, gc 6 import StringIO, gc, sys 7 7 8 8 EXAMPLE = """ … … 174 174 """ 175 175 176 LEAKS = """ 177 - mere scalar 178 - [ sequence, may, leak, too] 179 - {"it's": mapping, with: many, potential: leaks} 180 - {sequence: [], mapping: {}} 181 """ 182 176 183 class TestAttributes(unittest.TestCase): 177 184 … … 372 379 self.assert_(node.value[0] is node.value[1]) 373 380 381 class 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
