Segfault accessing dictionary in C Python module

Mitko Haralanov mitko at qlogic.com
Tue Apr 22 13:13:25 EDT 2008


On Mon, 21 Apr 2008 17:09:57 -0700 (PDT)
sturlamolden <sturlamolden at yahoo.no> wrote:

> Albeit not having looked at your code in detail, I'm wiling to bet you
> have one of the refcounts wrong.

It turns out you are correct. I forgot to increment the refcount on the
value extracted from the dict (since PyDict_GetItem returns a borrowed
reference). Once I did that, all was well.

Thank you!

-- 
Mitko Haralanov					 mitko at qlogic.com
Senior Software Engineer			     650.934.8064
HSG InfiniBand Engineering		    http://www.qlogic.com

==========================================
 Fry: Drugs are for losers, and hypnosis is for losers with big weird
eyebrows.



More information about the Python-list mailing list