summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <pochu@debian.org>2020-07-16 14:14:11 +0200
committerEmilio Pozuelo Monfort <pochu@debian.org>2020-07-29 10:20:41 +0200
commit31261f3aa25e090b7a6d3ff231eb46e342203181 (patch)
tree6f44dbd0de8ab96d43aff16a3d6294ea6460b9f2 /lib
parent0829982e87a2a68f36a5ad31ebfa579647a154ee (diff)
security_db: use pickle's dumps and loads
Rather than using StringIO in py2 and BytesIO in py3 and porting away from buffer which is also gone in py3, let's just use dumps and loads and let the pickle library handle the memory representation for us.
Diffstat (limited to 'lib')
-rw-r--r--lib/python/security_db.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/python/security_db.py b/lib/python/security_db.py
index 9313cb4949..a3d3052cb2 100644
--- a/lib/python/security_db.py
+++ b/lib/python/security_db.py
@@ -33,7 +33,6 @@ import base64
import bugs
from collections import namedtuple
import pickle
-import cStringIO
import glob
import itertools
import os
@@ -696,15 +695,14 @@ class DB:
return data
def toString(data):
- result = cStringIO.StringIO()
- pickle.dump(data, result)
- return buffer(result.getvalue())
+ return pickle.dumps(data)
for (old_print, contents) in cursor.execute(
"SELECT inodeprint, parsed FROM inodeprints WHERE file = ?",
(filename,)):
if old_print == current_print:
- return (True, pickle.load(cStringIO.StringIO(contents)))
+ print(pickle.loads(contents))
+ return (True, pickle.loads(contents))
result = do_parse(debian_support.PackageFile(filename))
cursor.execute("""UPDATE inodeprints SET inodeprint = ?, parsed = ?
WHERE file = ?""", (current_print, toString(result), filename))

© 2014-2024 Faster IT GmbH | imprint | privacy policy