Issue 787077: copy_reg globals in cPickle (original) (raw)

I'm not sure if it's a bug as such, but the following behaviour can be rather annoying if you're playing around with copy_reg.

On intialisation cPickle creates local copies of the 'dispatch_table', '_extension_registry', '_extension_cache', and '_inverted_registry' dictionaries from the copy_reg module. If that module is reloaded the dictionaries are reinitialised, and so out of sync with the copies in the cPickle modules, which one access from python.

thus the following code results in an Unpicklable exception.

import cPickle import copy_reg reload(copy_reg) import Numeric cPickle.dumps(Numeric.array([10,10,01]),1)