Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'none,': 0.05; 'python': 0.09; 'idea?': 0.09; 'sep': 0.09; 'sub': 0.09; 'subject:()': 0.09; "'0',": 0.16; '(3,': 0.16; '49,': 0.16; '__del__': 0.16; 'corrupt': 0.16; 'from:addr:boscolini.eu': 0.16; 'from:addr:matteo.boscolo': 0.16; 'from:name:matteo boscolo': 0.16; 'it".': 0.16; 'none),': 0.16; 'none).': 0.16; 'sentinel': 0.16; 'wrote:': 0.17; 'tries': 0.17; 'are:': 0.20; 'object.': 0.22; "skip:' 40": 0.22; 'references': 0.23; 'non': 0.24; 'script': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'am,': 0.27; 'object,': 0.27; "doesn't": 0.28; 'skip:( 20': 0.28; 'chris': 0.28; '>>>>': 0.29; 'crash': 0.29; "d'aprano": 0.29; 'steven': 0.29; 'objects': 0.29; 'class': 0.29; "skip:' 10": 0.30; 'code': 0.31; "skip:' 20": 0.32; 'could': 0.32; 'extract': 0.33; 'to:addr:python-list': 0.33; 'times.': 0.33; 'there': 0.35; 'but': 0.36; 'method': 0.36; 'does': 0.37; 'rather': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'some': 0.38; 'delete': 0.38; 'to:addr:python.org': 0.39; 'application': 0.40; 'skip:w 30': 0.61; 'back': 0.62; 'received:62': 0.62; 'situation': 0.62; 'received:unknown': 0.63; 'become': 0.65; "'with'": 0.84; 'construct': 0.84; 'object:': 0.84; 'subject:skip:g 10': 0.84; 'viable': 0.84; 'urgently': 0.91; 'remember,': 0.93 Date: Mon, 17 Sep 2012 19:23:23 +0200 From: Matteo Boscolo Organization: OmniaSolutions User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: gc.get_objects() References: <52847c35-388c-4758-b72d-1d1859b788a3@googlegroups.com> <8370412f-5176-45ff-87eb-72cbca5149d5@googlegroups.com> <5055a1a6$0$29981$c3e8da3$5496439d@news.astraweb.com> <4f9d9a0b-539a-4b6a-af3e-b02d1f4006ee@googlegroups.com> <505730ad$0$29981$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: smtplq01.aruba.it 1.6.2 0/1000/N X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 73 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1347902617 news.xs4all.nl 6936 [2001:888:2000:d::a6]:43090 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:29383 from my gc.get_object() I extract the sub system of the object that I would like to delete: this is the object: Class name win32com.gen_py.F4503A16-F637-11D2-BD55-00500400405Bx0x1x0.ITDProperty.ITDProperty that is traked and the reference are: get_referents >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> RefCount 5 >>>> (,) RefCount 5 >>>> '__int__': , '__module__': 'win32com.gen_py.F45 RefCount 8 >>>> ITDProperty RefCount 9 >>>> RefCount 9 >>>> get_referrers >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> RefCount 15 >>>> 'python_version': 34014192, 'defaultUnnamedArg': >>>> >>>> (u'ItemsListCreator', u'trick', u'pVal'), (3, 49, '0', None), (16393, 10, None, RefCount 4 >>>> RefCount 7 >>>> RefCount 5 >>>> '{39AAEA35-F71F-11D2-BD59-00500400405B}': On Tue, Sep 18, 2012 at 12:16 AM, Steven D'Aprano > wrote: >> The __del__ method does not delete an object. Remember, objects are only >> deleted when there are no references to it. Otherwise you could have some >> code that tries to use a deleted object, and you would get a system crash >> or BSOD. > There is a conceptually viable alternative: destroy an object > immediately and force all references to it to become some sentinel > value (eg None). Python currently doesn't have this, but it would be > rather convenient at times. Could be part of a construct like 'with' > to say "make this, use it, and then dispose of it". > > ChrisA