[C++-sig] inner class pickle issue

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Fri Oct 5 01:14:20 CEST 2007


> Or only the top level class can be pickled?

Yes.

Try this:

import pickle
class outer(object):
  class inner(object): pass
oi = outer.inner()
pickle.dumps(oi)

You'll get a similar error message:

pickle.PicklingError: Can't pickle <class '__main__.inner'>: it's not found as __main__.inner

Ralf








More information about the Cplusplus-sig mailing list