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
commitef4aa74de352082d0efdae45adf4bbe4a2d47c07 (patch)
tree65362dc5fc58f92183f2ad1535e30ff7cc9ee725 /lib
parent40bea495dab92cde18bf41acea83b8e76f55bcf9 (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