Make SFTPClient._async_request check basestring, not str #235

ksamuel opened this Issue Nov 18, 2013 · 1 comment


None yet

2 participants

ksamuel commented Nov 18, 2013

Arround line 700, we got :

        for item in arg:
            if isinstance(item, int):
            elif isinstance(item, long):
            elif isinstance(item, str):
            elif isinstance(item, SFTPAttributes):
                raise Exception('unknown type for %r type %r' % (item, type(item)))

Which mean you can't pass subclasses of unicode there. Either you make this check :

isinstance(item, basetring)

Or you make an explicit message explaining you reject non encoded strings. Otherwise, it's hard to understand what's going on when you get :

Exception: unknown type for unicode_subclass(u'/stuff') type <class ''>

Thanks for looking out! This should have been fixed in the recent merge of Python 3 support; that line now looks like this: - and string_types under Python 2 is basestring.

This change is live in version 1.13 and I will go backport it to a few older branches that are Python 2 only; their next bugfix releases will have the change.

@bitprophet bitprophet closed this Mar 14, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment