Hi!
I've found it's a bit strange that a FileObject, created over opened file, doesn't use that file's mode, but defaults it to 'rb'.
Here is the patch to the gevent/fileobject.py that changes this behaviour to copy opened file's mode by default. It falls back to the default 'rb' if the fobj hasn't got the `mode` attribute.
153c153
< def __init__(self, fobj, mode='rb', bufsize=-1, close=True):
---
> def __init__(self, fobj, mode=None, bufsize=-1, close=True):
158a159,163
> if mode is None:
> try:
> mode = fobj.mode
> except AttributeError:
> mode = 'rb'
With best regards,
Eleneldil ( Danil )