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:
William S Fulton 2016-10-13 19:44:11 +01:00
commit d2cb98c134
2 changed files with 13 additions and 0 deletions

View file

@ -18,3 +18,11 @@ if python_pickle.cvar.debug:
pickle_string = pickle.dumps(p)
newp = pickle.loads(pickle_string)
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

View file

@ -48,4 +48,9 @@ struct PickleMe {
std::cout << "In C++ constructor " << " [" << msg << "]" << std::endl;
}
};
struct NotForPickling {
std::string msg;
NotForPickling(const std::string& msg) : msg(msg) {}
};
%}