pycapnp/capnp/lib/pickle_helper.py
Madhava Jay fc617142c0 Fixed issue where pickle helpers didnt use new from_bytes with context
- Added with context to benchmarks that use with_bytes
2022-05-24 11:38:27 +10:00

7 lines
270 B
Python

import capnp
def _struct_reducer(schema_id, data):
'Hack to deal with pypy not allowing reduce functions to be "built-in" methods (ie. compiled from a .pyx)'
with capnp._global_schema_parser.modules_by_id[schema_id].from_bytes(data) as msg:
return msg