Browse Source

Check if data is already bytes

test_fixup
Jessica Hair 4 years ago
parent
commit
c9f15fef84
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      libarchive/__init__.py

+ 4
- 1
libarchive/__init__.py View File

@@ -550,7 +550,10 @@ class Archive(object):

if data:
if PY3:
result = _libarchive.archive_write_data_from_str(self._a, data.encode('utf8'))
if isinstance(data, bytes):
result = _libarchive.archive_write_data_from_str(self._a, data)
else:
result = _libarchive.archive_write_data_from_str(self._a, data.encode('utf8'))
else:
result = _libarchive.archive_write_data_from_str(self._a, data)
_libarchive.archive_write_finish_entry(self._a)


Loading…
Cancel
Save