Source

pyobjc / pyobjc-framework-Cocoa / PyObjCTest / test_nsautoreleasepool.py

Full commit
from PyObjCTools.TestSupport import *
import objc

from Foundation import *

class TestNSAutoreleasePoolInteraction(TestCase):

    def testNSAutoreleasePoolPlain(self):
        pool = NSAutoreleasePool.alloc().init()
        bar = NSMutableArray.array()
        del pool # Always use 'del pool' instead of 'pool.release()'!
        bar.addObject_( b"a".decode('ascii') ) # should still exist because of python GC

if __name__ == '__main__':
    main( )