BUG: compat_pickle should not modify global namespace