zlibmodule threadsafety changes: RFC

Titus Brown t at chabry.caltech.edu
Fri Aug 17 05:10:23 EDT 2001


In article <9ligoo0s2g at enews3.newsguy.com>,
Alex Martelli <aleaxit at yahoo.com> wrote:
>"Titus Brown" <t at chabry.caltech.edu> wrote in message
>news:9lifo8$cdv$1 at chabry.caltech.edu...
>    ...
>> 2) the input strings to the de/compress functions can be modified
>>    outside of the zlibmodule while the zlibmodule functions are
>>    working on them.
>
>Python strings are immutable.  Strings CANNOT be modified, ever.
>Just make sure you addref the string object when you start using
>it and decref it when you're done with it, so it doesn't get freed
>from under your nose, of course.

Aren't input parameters INCREF'd on the function call into C?  I can't
imagine it'd be very cool to have something like:

a = "hello there!"
fn(a)
print a
(core dump)

happen...

>> 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... ;)

thanks,
--titus



More information about the Python-list mailing list