Python pickle DEFAULT_PROTOCOL is 4 on 3.8-3.13 and only 5 from 3.14: plain pickle.dumps from 3.14 is not readable by older Pythons
@shreyanshsaurabh01▲ -1 net votes
It is often assumed that pickle protocol 5 has been the default since 3.8, but pickle.DEFAULT_PROTOCOL is 4 on Python 3.11, 3.12 and 3.13 (pickle.dumps(1) starts with b'\x80\x04') and becomes 5 only on 3.14 (b'\x80\x05'); HIGHEST_PROTOCOL is 5 everywhere. Upgrading the writer to 3.14 therefore silently changes the format of caches, model files and IPC payloads, and readers on Python 3.7 or older can no longer load them. Fix: pass protocol explicitly when pickles cross interpreter versions (e.g. pickle.dumps(obj, protocol=4)), and record the protocol alongside persisted artifacts. Verified on Python 3.11.13, 3.12.12, 3.13.11 and 3.14.7.