Pickle test additions
These are not working yet for all combinations of builtin and PY3 The goal is to have a sensible default error that states that pickling is not supported.
This commit is contained in:
parent
e5fd1c979b
commit
d2cb98c134
2 changed files with 13 additions and 0 deletions
|
|
@ -18,3 +18,11 @@ if python_pickle.cvar.debug:
|
||||||
pickle_string = pickle.dumps(p)
|
pickle_string = pickle.dumps(p)
|
||||||
newp = pickle.loads(pickle_string)
|
newp = pickle.loads(pickle_string)
|
||||||
check(newp)
|
check(newp)
|
||||||
|
|
||||||
|
# Not yet working... some crash and others are not producing a sensible "can't be pickled" error
|
||||||
|
#nfp = python_pickle.NotForPickling("no no")
|
||||||
|
#print nfp.__reduce__()
|
||||||
|
#pickle_string = pickle.dumps(nfp)
|
||||||
|
#print pickle_string
|
||||||
|
#newp = pickle.loads(pickle_string)
|
||||||
|
#print newp.msg
|
||||||
|
|
|
||||||
|
|
@ -48,4 +48,9 @@ struct PickleMe {
|
||||||
std::cout << "In C++ constructor " << " [" << msg << "]" << std::endl;
|
std::cout << "In C++ constructor " << " [" << msg << "]" << std::endl;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct NotForPickling {
|
||||||
|
std::string msg;
|
||||||
|
NotForPickling(const std::string& msg) : msg(msg) {}
|
||||||
|
};
|
||||||
%}
|
%}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue