Browse Source

Merge pull request #11 from smartfile/python3

Check if data is already bytes
test_fixup
Clifton Barnes 5 years ago
committed by GitHub
parent
commit
cd7161aea7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
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 data:
if PY3: 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: else:
result = _libarchive.archive_write_data_from_str(self._a, data) result = _libarchive.archive_write_data_from_str(self._a, data)
_libarchive.archive_write_finish_entry(self._a) _libarchive.archive_write_finish_entry(self._a)


Loading…
Cancel
Save