Skip to content

Commit 140652f

Browse files
committed
Deletes BLOB converter on close
1 parent d4397d7 commit 140652f

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

addon.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2-
<addon id="script.module.cache" name="cache" version="1.0.1" provider-name="fraser">
2+
<addon id="script.module.cache" name="cache" version="1.0.2" provider-name="fraser">
33
<requires>
44
<import addon="xbmc.python" version="2.26.0"/>
55
</requires>
@@ -14,6 +14,6 @@ Can be used as a generic key/blob data store when used without directives
1414
<platform>all</platform>
1515
<email>fraser.chapman@gmail.com</email>
1616
<source>https://github.com/FraserChapman/script.module.cache</source>
17-
<news>v1.0.1 (6-7-19) - Small bug-fix with Store class retrieve</news>
17+
<news>v1.0.2 (14-7-19) - Deletes BLOB converter on close</news>
1818
</extension>
1919
</addon>

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
v1.0.2 - Deletes BLOB converter on close
12
v1.0.1 - Small bug-fix with Store class retrieve
23
v1.0.0 - Initial version

lib/cache.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def datetime_to_httpdate(input_date):
5555

5656
def conditional_headers(row):
5757
# type: (sqlite3.Row) -> dict
58-
"""Creates dict of conditional request headers based on row etag and last_modified"""
58+
"""Creates conditional request header dict based on etag and last_modified"""
5959
headers = {}
6060
if row["etag"] is not None:
6161
headers["If-None-Match"] = row["etag"]
@@ -92,7 +92,7 @@ def _save(self, data):
9292
# type: (set) -> None
9393
"""Saves set of strings"""
9494
with Cache(self.db) as c:
95-
if type(data) is set:
95+
if isinstance(data, set):
9696
c.set(self.key, data)
9797

9898
def append(self, item):
@@ -267,9 +267,7 @@ def _open(self, name):
267267
sqlite3.enable_callback_tracebacks(True)
268268
sqlite3.register_converter("BLOB", Blob.deserialise)
269269
try:
270-
self.connection = sqlite3.connect(name,
271-
timeout=1,
272-
detect_types=sqlite3.PARSE_DECLTYPES)
270+
self.connection = sqlite3.connect(name, timeout=1, detect_types=sqlite3.PARSE_DECLTYPES)
273271
except sqlite3.Error as e:
274272
logger.debug(e)
275273
return
@@ -281,6 +279,9 @@ def _open(self, name):
281279
def _close(self):
282280
# type: () -> None
283281
"""Closes any open connection and cursor"""
282+
# remove module level register_converter
283+
# see: https://github.com/jdf76/plugin.video.youtube/issues/640
284+
del sqlite3.converters["BLOB"]
284285
if self.connection:
285286
self.connection.cursor().close()
286287
self.connection.close()

0 commit comments

Comments
 (0)