Skip to content

Instantly share code, notes, and snippets.

@mstefanro
Created July 22, 2012 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mstefanro/3160943 to your computer and use it in GitHub Desktop.
Save mstefanro/3160943 to your computer and use it in GitHub Desktop.
Progress in implementing pickle4
/----------------------------------------------------------------------------\
| Feature | pickle.py | _pickle.c |
|============================================================================|
| pickling of very large bytes and strings | Yes | Yes |
| better pickling of small strings and bytes | Yes | Yes |
| native pickling of sets and frozensets | Yes | Yes |
| self-referential sets | Yes | Yes |
| self-referential frozensets | Yes | Yes |
| removal of BINPUT opcode | Yes | Yes |
| improved error checking | Yes | |
| BINGLOBAL as a replacement of GLOBAL | Yes | Yes |
| BINGLOBAL_BIG for unusually large global names | Yes | Yes |
| BINGLOBAL_COMMON for commonly used module names | Yes | Yes |
| pickling of nested globals | Yes | Yes |
| use BAIL_OUT opcode on error | Yes | Yes |
| pickling calls to __new__ with keyword args | Yes | Yes |
| fix __reduce__ bug for sets etc. [1] | Yes |
| pickling of weird functions and methods [2] | Yes | Yes |
| __getnewargs_kw__ | Yes |
| zig-zag encoding of signed integers | | |
| unicode compression of strings | | |
| passing all tests in cpython | | |
\----------------------------------------------------------------------------/
/----------------------------------------------------------------------------\
| Feature | Tests |
|============================================================================|
| pickling of very large bytes and strings | - |
| | |
| better pickling of small strings and bytes | test_v4_efficient_unicode |
| | test_v4_efficient_bytes |
| | |
| native pickling of sets and frozensets | test_v4_sets |
| | test_v4_sets_opcodes |
| | |
| self-referential sets | test_v4_set_refs |
| | test_v4_cycles |
| | |
| self-referential frozensets | test_v4_set_refs |
| | test_v4_cycles |
| | |
| removal of BINPUT opcode | - |
| | |
| improved error checking | test_v4_exceptions |
| | |
| BINGLOBAL as a replacement of GLOBAL | - |
| | |
| BINGLOBAL_BIG for unusually large global name | test_v4_binglobal_big |
| | |
| BINGLOBAL_COMMON for commonly used module | |
| names | test_v4_binglobal_common |
| | |
| pickling of nested globals | test_v4_nested_classes |
| | |
| use BAIL_OUT opcode on error | test_v4_bail_out |
| | |
| pickling calls to __new__ with keyword args | test_v4_new_kwargs |
| | |
| fix __reduce__ bug for sets etc. [1] | test_v4_reduce_cycles |
| | |
| pickling of weird functions and methods [2] | test_v4_weird_funcs |
| | test_v4_pickle_bound_m.. |
| | |
| __getstate__ | test_v4_getnewargs_and.. |
| | |
| __getnewargs__ | test_v4_getnewargs_and.. |
| | |
| __getnewargs_kw__ | test_v4_getnewargs_and.. |
| | test_v4_bad_getnewargs.. |
| | |
| zig-zag encoding of signed integers | - |
| | |
| unicode compression of strings | - |
\----------------------------------------------------------------------------/
[1] set/frozenset's __reduce__ can't create self-referential data structures.
make it use state instead. the object needs to be memoized prior to setting
its state, otherwise this won't work.
[2] this includes: list.append, list.__add__, [].append, [].__add__,
dict.fromkeys, len, classmethods and staticmethods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment