Message 17465 - Python tracker (original) (raw)
Logged In: YES user_id=699265
Skip --
I stand corrected (for cPickle, anyway) - but I imagine there is a performance degredation over the "old" way of doing things - if I get a chance, I'll test that.
The problem does still exist at least in marshal (.load and .dump only accept a "real" file object). I did a grep for PyFile_Check in the source tree prior to posting the bug report, and was a little over zealous to include cPickle in the subject. There are other places in the source ( and possibly in 3rd party extensions) which use PyFile_Check, and I haven't had a change to analyze those yet.
In any case, marshal doesn't work - in your test, if you change the cPickle to marshal, you'll get:
Traceback (most recent call last): File "x.py", line 10, in ? marshal.dump("Hello, world", f) TypeError: marshal.dump() 2nd arg must be file
Again, I'm not sure of the impact other places where PyFile_Check is used, and I don't know the performance loss in cPickle (as compared to the "real" file implementation in pre-2.3 socket.makefile())
Let me know if there is anything I can do to help debug/fix!