Skip to content

Commit

Permalink
Changed cleanup of cached decompressors to manual
Browse files Browse the repository at this point in the history
  • Loading branch information
ajkxyz committed Apr 9, 2017
1 parent f811977 commit c4cc0a2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion setup.py
Expand Up @@ -42,7 +42,7 @@
setup(
name="jpeg4py",
description="libjpeg-turbo cffi bindings and helper classes",
version="0.1.1",
version="0.1.2",
license="Simplified BSD",
author="Samsung Electronics Co.,Ltd.",
author_email="a.kazantsev@samsung.com",
Expand All @@ -61,6 +61,8 @@
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Topic :: Software Development :: Libraries"
]
)
8 changes: 4 additions & 4 deletions src/jpeg4py/_py.py
Expand Up @@ -68,7 +68,7 @@ def __init__(self, lib_):
def get_last_error(self):
"""Returns last error string.
"""
return ffi.string(self.lib_.tjGetErrorStr()).decode("utf-8")
return jpeg.ffi.string(self.lib_.tjGetErrorStr()).decode("utf-8")


class Handle(Base):
Expand All @@ -92,9 +92,6 @@ def release(self):
self.lib_.tjDestroy(self.handle_)
self.handle_ = None

def __del__(self):
self.release()


class JPEG(Base):
"""Main class.
Expand All @@ -117,6 +114,9 @@ class JPEG(Base):
def clear():
"""Clears internal caches.
"""
# Manually release cached JPEG decompressors
for handle in reversed(JPEG.decompressors):
handle.release()
del JPEG.decompressors[:]

def __init__(self, source, lib_=None):
Expand Down

0 comments on commit c4cc0a2

Please sign in to comment.