zlibmodule threadsafety changes: RFC

Alex Martelli aleaxit at yahoo.com
Fri Aug 17 18:36:25 CEST 2001

"Titus Brown" <t at chabry.caltech.edu> wrote in message
news:9lin1v$d57$1 at chabry.caltech.edu...
> Aren't input parameters INCREF'd on the function call into C?  I can't

Nope: if the C code wants to keep hold of them it needs to incref
them itself (only while the specific Python-called C function itself is
executing is the object guaranteed not to go away).

> imagine it'd be very cool to have something like:
> a = "hello there!"
> fn(a)
> print a
> (core dump)

Could happen, if fn decref'd a by more than it addref'd.

> >> http://chabry.caltech.edu/~t/transfer/zlibmodule.c
> >
> >I get a 404 on this:
> fixed.  The file that is there contains my latest changes, which I have
> just submitted as a patch (taking out the unnecessary cruft & fixing up
> the comments to reflect my new understanding of Python strings... ;)

Works now, thanks.  Will examine it later.


More information about the Python-list mailing list