Py_INCREF() incomprehension
Hegedüs, Ervin
airween at gmail.com
Mon May 2 02:41:14 EDT 2011
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.
More information about the Python-list
mailing list