summaryrefslogtreecommitdiff
path: root/config.py
diff options
context:
space:
mode:
authorcpopa <devnull@localhost>2014-07-24 14:51:23 +0200
committercpopa <devnull@localhost>2014-07-24 14:51:23 +0200
commit8d18e9a1d5e820e4774ee811b495f52b4071683a (patch)
tree2a8199857aed4fad848cd8ee74c8a80813b945a0 /config.py
parent0378d563989c10402c882bf3e8ca9af9a025a60a (diff)
downloadpylint-8d18e9a1d5e820e4774ee811b495f52b4071683a.tar.gz
Use the proper mode for pickle when opening and writing the stats file. Closes issue #148.
Diffstat (limited to 'config.py')
-rw-r--r--config.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/config.py b/config.py
index 992c293..c346a0e 100644
--- a/config.py
+++ b/config.py
@@ -50,15 +50,15 @@ def load_results(base):
"""
data_file = get_pdata_path(base, 1)
try:
- with open(data_file) as stream:
+ with open(data_file, _PICK_LOAD) as stream:
return pickle.load(stream)
except:
return {}
if sys.version_info < (3, 0):
- _PICK_MOD = 'w'
+ _PICK_DUMP, _PICK_LOAD = 'w', 'r'
else:
- _PICK_MOD = 'wb'
+ _PICK_DUMP, _PICK_LOAD = 'wb', 'rb'
def save_results(results, base):
"""pickle results"""
@@ -69,7 +69,7 @@ def save_results(results, base):
print >> sys.stderr, 'Unable to create directory %s' % PYLINT_HOME
data_file = get_pdata_path(base, 1)
try:
- with open(data_file, _PICK_MOD) as stream:
+ with open(data_file, _PICK_DUMP) as stream:
pickle.dump(results, stream)
except (IOError, OSError), ex:
print >> sys.stderr, 'Unable to create file %s: %s' % (data_file, ex)