There are cases where protocol 0 doesn't work at all, but a higher protocol might:
#> |class Box:__slots__='item'|
>>> class Box:__slots__='item'
#> .#(Box)
>>> # CompileError
(> > > >><__main__.Box object at 0x000001B3E0C344C0><< < < <)
# Compiler.pickle() TypeError:
# cannot pickle 'Box' object: a class that defines __slots__ without defining __getstate__ cannot be pickled with protocol 0
#> (pickle..dumps (Box))
>>> __import__('pickle').dumps(
... Box())
b'\x80\x04\x95\x17\x00\x00\x00\x00\x00\x00\x00\x8c\x08__main__\x94\x8c\x03Box\x94\x93\x94)\x81\x94.'
The compiler already checks if the highest protocol is shorter and uses it in some cases. It just needs to not give up if protocol 0 fails.
There are cases where protocol 0 doesn't work at all, but a higher protocol might:
The compiler already checks if the highest protocol is shorter and uses it in some cases. It just needs to not give up if protocol 0 fails.