_compat_pickle
| Use Case | Mapping | Description |
|---|---|---|
| ๐๏ธ Python 2 โ Python 3 module import | IMPORT_MAPPING |
Maps old Python 2 module names to their Python 3 equivalents (e.g., BaseHTTPServer โ http.server) |
| ๐ Reverse Python 3 โ Python 2 module import | REVERSE_IMPORT_MAPPING |
Maps back Python 3 internal module names to Python 2 names (e.g., _bz2 โ bz2) |
| ๐ท๏ธ Python 2 โ Python 3 name (class/function) | NAME_MAPPING |
Maps old (module, name) pairs to new (module, name) (e.g., ('UserDict', 'IterableUserDict') โ ('collections', 'UserDict')) |
| ๐ Reverse Python 3 โ Python 2 name | REVERSE_NAME_MAPPING |
Maps back new names to old (e.g., ('_functools', 'reduce') โ ('__builtin__', 'reduce')) |
| โ ๏ธ Python 2 exceptions list | PYTHON2_EXCEPTIONS |
Set of exception names that existed in Python 2 (e.g., ArithmeticError, AssertionError) |
| ๐ซ Python 3 import error exceptions | PYTHON3_IMPORTERROR_EXCEPTIONS |
Set of exception names related to import errors in Python 3 (e.g., ModuleNotFoundError) |
| ๐ Python 3 OS error exceptions | PYTHON3_OSERROR_EXCEPTIONS |
Set of exception names under OSError in Python 3 (e.g., BrokenPipeError, ChildProcessError) |
| ๐งต Multiprocessing exceptions | MULTIPROCESSING_EXCEPTIONS |
Set of exception names from the multiprocessing module (e.g., AuthenticationError, BufferTooShort) |
https://docs.python.org/3.10/library/_compat_pickle.html
The following documentation is automatically generated from the Python source files. It may be incomplete, incorrect or include features that are considered implementation detail and may vary between Python implementations. When in doubt, consult the module reference at the location listed above.
This module is used to map the old Python 2 names to the new names used in Python 3 for the pickle module. This is needed to make pickle streams generated with Python 2 loadable by Python 3.
IMPORT_MAPPING = {'BaseHTTPServer': 'http.server', 'CGIHTTPServer': 'h...MULTIPROCESSING_EXCEPTIONS = ('AuthenticationError', 'BufferTooShort',...NAME_MAPPING = {('UserDict', 'IterableUserDict'): ('collections', 'Use...PYTHON2_EXCEPTIONS = ('ArithmeticError', 'AssertionError', 'AttributeE...PYTHON3_IMPORTERROR_EXCEPTIONS = ('ModuleNotFoundError',)PYTHON3_OSERROR_EXCEPTIONS = ('BrokenPipeError', 'ChildProcessError', ...REVERSE_IMPORT_MAPPING = {'_bz2': 'bz2', '_dbm': 'dbm', '_dummy_thread...REVERSE_NAME_MAPPING = {('_functools', 'reduce'): ('__builtin__', 'red...excname = 'ModuleNotFoundError'/usr/lib/python3.10/_compat_pickle.py
Generated by phpman v4.9.27 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-19 18:04 @216.73.216.114
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format