Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.021 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'exception,': 0.07; 'question:': 0.09; 'debugging': 0.14; '"error",': 0.16; '>it': 0.16; 'objects?': 0.16; 'printf': 0.16; 'subject:() ': 0.16; 'thanks,': 0.17; 'stuff': 0.18; 'exists': 0.19; 'obviously': 0.20; 'seems': 0.21; 'header:In-Reply-To:1': 0.22; 'gregory': 0.23; 'here?': 0.23; 'guess': 0.26; 'there.': 0.26; "i'll": 0.26; 'object': 0.27; 'looks': 0.28; 'skip:p 30': 0.29; '(as': 0.29; '>and': 0.31; 'does': 0.31; 'it.': 0.31; 'to:addr:python-list': 0.32; 'done': 0.32; 'thank': 0.32; 'sorry': 0.33; 'module': 0.33; 'reference': 0.34; 'there': 0.35; 'header:User-Agent:1': 0.35; 'point': 0.35; 'hello,': 0.36; 'think': 0.36; 'problem.': 0.36; 'enough': 0.37; 'some': 0.37; 'should': 0.37; 'but': 0.38; 'happens': 0.38; 'docs': 0.39; 'ok,': 0.39; 'to:addr:python.org': 0.39; 'where': 0.39; 'how': 0.39; 'would': 0.40; 'header:Received:5': 0.40; 'received:86': 0.60; 'here': 0.65; 'received:hu': 0.84; 'safer': 0.95 X-Spam-Score: -1.347 X-Spam-Level: X-Spam-Status: No, score=-1.347 tagged_above=-20 required=4 tests=[AWL=0.022, BAYES_00=-2.599, DNS_FROM_OPENWHOIS=1.13, RDNS_NONE=0.1] Date: Mon, 2 May 2011 08:41:14 +0200 From: =?utf-8?B?SGVnZWTDvHMs?= Ervin To: python-list@python.org Subject: Re: Py_INCREF() incomprehension References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 52 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1304318485 news.xs4all.nl 81482 [::ffff:82.94.164.166]:42812 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:4443 hello, Thomas, Gregory, thank you for your ansrwers, > I guess this is the point where yo should start printf programing. oh', already done :) > * What happens during module initialization? successfully initialized, > * What happens n the functions? > * Where does the stuff fail? > * What are the reference counts of the involved objects? sorry for the dumb question: how can I controll number of reference in C? > > PyModule_AddObject(o, "error", cibcrypt_error_nokey); > > Py_INCREF(cibcrypt_error_nokey); > > > >and now if there is some expected exception, I get it. > > >Any explanation? > > I don't have one - I would think that if the module object exists > for all the time, it would be enough to have one reference there. > > But obviously it is not enough - did you at any time del something > related to here? The module or one of its attributes? > > Anyway, it seems safer to do INCREF here - so do it. (As Gregory > already stated - it looks cleaner if you do INCREF before > AddObject.) ok, > > >ps: this is just for my passion, but I would like to understand > >it very-very much :) > > Understandable. That's that the printf debugging of the refcounts > can be good for - even if you don't really have a problem. thanks, I'll go to read the docs :) bye: a.