zlibmodule threadsafety changes: RFC
Titus Brown
titus at caltech.edu
Fri Aug 17 03:57:32 EDT 2001
On Fri, Aug 17, 2001 at 05:33:46PM +1000, Richard Jones wrote:
-> On Friday 17 August 2001 17:05, Titus Brown wrote:
-> > 2) the input strings to the de/compress functions can be modified
-> > outside of the zlibmodule while the zlibmodule functions are
-> > working on them.
->
-> I naively ask whether this is actually true... aren't python strings
-> immutable? Unless someone plays with them under the covers in C, that is (in
-> which case they're being very naughty and deserve what they get).
Hooray! It looks like you're right; I naively took a look at the zlibmodule
code and assumed that functions like _PyString_Resize meant otherwise, and
promptly forgot about the issue. I just read the docs on it, tho, and...
there's an explicit warning about using that function!
This simplifies matters considerably!
thanks,
--titus, who will do better with reading the docs next time...
PS Interesting, it looks like '+=' does some behind-the-scenes skullduggery
when applied to strings... since 's = t = "a"; t += "b"; print s' doesn't
do what I would have thought, given that += is supposed to "modify in place",
I thought.
More information about the Python-list
mailing list