Python pickle supports the listed built-in constants, numeric types, strings, bytes, and bytearrays. Function and class definitions are not serialized by value; eligible top-level functions and classes are represented by their fully qualified names, so their defining module must be importable and contain the named object when unpickled.
Community Discussion