File and IO handling in Py3 is different than Py2

Instead of checking whether data isinstance of 'file', then we check that
it is file-like _enough_ to be treated as a file (i.e. it hasattr 'read').
fix/24-enc-to-file
Mikael Nordfeldth 2013-07-24 15:53:37 +02:00
parent 72174ad535
commit 1bdf0290ab
1 changed files with 1 additions and 1 deletions

View File

@ -180,7 +180,7 @@ class GPG(GPGBase):
else:
log.warn("No 'default_key' given! Using first key on secring.")
if isinstance(data, file):
if hasattr(data, 'read'):
result = self._sign_file(data, **kwargs)
elif not _is_stream(data):
stream = _make_binary_stream(data, self._encoding)