Do I understand correctly that the issue is that python Pickler class has dispatch attribute but C Pickler does not? The add_dispatch_check-0.patch patch does not seem to add class attribute, it adds an instance attribute instead.
I also noticed that there are many more class attributes that only Python implementation has:
>>> for x in dir(pickle._Pickler):
... if not (x.startswith('_') or hasattr(pickle.Pickler, x)):
... print(x)
...
dispatch
get
memoize
put
save
save_bool
save_bytes
save_dict
save_float
save_global
save_list
save_long
save_none
save_pers
save_reduce
save_str
save_tuple
The save_* methods are clearly internal and should probably be renamed to begin with __ unless they are intended to be overridden by Pickler subclases |