scipy/scipy — pull request #3241 by matthew-brett (2014-01-24 19:28:28+00:00)
Title: RF: check write attr of fileobject without writing

I was checking whether passed file object could write by doing a write of an
empty string. Writing an empty string can fail for bz2 objects in python 3.3:

http://bugs.python.org/issue16828

In any case, testing that 'write' is callable with an empty string is asking
too much of the interface. Instead just check if the object has a
'write' attribute.