Created
July 15, 2018 18:58
-
-
Save npow/f6044b4a011fe9724cd8ac7d6be5f7c7 to your computer and use it in GitHub Desktop.
pickle bug?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pickle | |
import numpy as np | |
import multiprocessing as mp | |
a = np.array([1,2,3], dtype=np.uint32) | |
b = np.array([1,2,3], dtype=np.uint32) | |
c = np.array([1,2,3], dtype=np.uint32) | |
d = np.array([1,2,3], dtype=np.uint32) | |
q = mp.Queue() | |
q.put(a) | |
d = q.get() | |
print(id(a), id(b), id(c), id(d)) | |
print('[a]==[b]', pickle.dumps([a]) == pickle.dumps([b])) | |
print('[a]==[c]', pickle.dumps([a]) == pickle.dumps([c])) | |
print('[b]==[c]', pickle.dumps([b]) == pickle.dumps([c])) | |
print('[a,b]==[a,c]', pickle.dumps([a,b]) == pickle.dumps([a,c])) | |
print('[a,b]==[a,d]', pickle.dumps([a,b]) == pickle.dumps([a,d])) | |
print('c.tolist()==d.tolist()', c.tolist()==d.tolist()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment