Skip to content

Commit 4a136c8

Browse files
committed
fix for issue2294: don't pickle hooks
1 parent 08e57d7 commit 4a136c8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

astroquery/query.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import abc
55
import inspect
66
import pickle
7+
import copy
78
import getpass
89
import hashlib
910
import keyring
@@ -26,6 +27,10 @@
2627

2728
def to_cache(response, cache_file):
2829
log.debug("Caching data to {0}".format(cache_file))
30+
response = copy.deepcopy(response)
31+
if hasattr(response, 'request'):
32+
for key in tuple(response.request.hooks.keys()):
33+
del response.request.hooks[key]
2934
with open(cache_file, "wb") as f:
3035
pickle.dump(response, f)
3136

0 commit comments

Comments
 (0)