Skip to content

Commit

Permalink
Fix py39 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
kyamagu committed Jan 15, 2021
1 parent 850259e commit 5f561dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox:tox]
envlist = clean,py36,py37,py38,report
envlist = clean,py36,py37,py38,py39,report

[testenv]
commands = py.test --cov=psd_tools --cov-append --cov-report=term []
Expand All @@ -10,7 +10,7 @@ deps=
cython
depends =
{py36,py37,py38}: clean
report: py36,py37,py38
report: py36,py37,py38,py39

[testenv:report]
deps = coverage
Expand Down
4 changes: 2 additions & 2 deletions src/psd_tools/compression/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def encode_prediction(data, w, h, depth):
arr = array.array('B', data)
arr = _shuffle_byte_order(arr, w, h)
arr = _delta_encode(arr, 0x100, w * 4, h)
return getattr(arr, 'tobytes', getattr(arr, 'tostring'))()
return getattr(arr, 'tobytes', getattr(arr, 'tostring', None))()
else:
raise ValueError('Invalid pixel size %d' % (depth))

Expand All @@ -128,7 +128,7 @@ def decode_prediction(data, w, h, depth):
else:
raise ValueError('Invalid pixel size %d' % (depth))

return getattr(arr, 'tobytes', getattr(arr, 'tostring'))()
return getattr(arr, 'tobytes', getattr(arr, 'tostring', None))()


def _delta_encode(arr, mod, w, h):
Expand Down

0 comments on commit 5f561dc

Please sign in to comment.