Repository navigation
v5.8.4
Extends SafeDisk.with_numpy() to numpy data in keys and to more numpy types in values, and fixes the data stored for short-lived array views. The cache.db schema and the file layout are unchanged, and entries 5.8.3 could store are written byte for byte as before.
Changes
SafeDisk.with_numpy()accepts numpy booleans, integers, floats, complex numbers, strings and bytes in keys, also inside tuples, lists, dicts, sets and frozensets, and stores them as the Python valuesitem()gives, soint64(1)and1name the same entry. They raisedTypeError(PR #47).SafeDisk.with_numpy()accepts arrays in keys, alone or inside other keys, and asmemoizearguments. Every array in a key is stored in C order, so an equal array of the same dtype and shape names the same entry; another dtype, shape or time unit names another one. A key without numpy keeps the bytes earlier versions wrote (PR #47).SafeDisk.with_numpy()storesdatetime64andtimedelta64scalars with their unit, arrays of objects element by element (each element checked like any value), record arrays and masked arrays with their type, and memory maps as the plain array of their data. They raisedTypeError. A time unit with a multiple of more than nine digits still raisesTypeError. These entries, and keys holding numpy data, read as unreadable on 5.8.3 and earlier (PR #47).
Fixes
SafeDisk.with_numpy()stores each short-lived array a value hands to pickle with its own data. A value whose pickling made temporary views of one array, such as an object whose__reduce__yields slices, could be stored with one view's data in place of later ones, which then read back wrong. Affected 5.8.2 and 5.8.3 (PR #47).