diff options
| author | David Lechner <david@pybricks.com> | 2022-06-10 12:28:56 -0500 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2022-06-21 00:44:49 +1000 |
| commit | a565811f23c675ccbeed636c065828cdaf5fa96a (patch) | |
| tree | 947cde359e85a6c97232b9df5cb6d2dcecd773f2 /docs/library | |
| parent | c118b5d0e428094bd64a003d97b078c2d7c7500d (diff) | |
extmod/modbtree: Use buffer protocol for keys/values.
This changes the btree implementation to use the buffer protocol for
reading key/values in all methods. `str` and `bytes` objects are not the
only bytes-like objects that could be used.
Documentation and tests are also updated.
Addresses issue #8748.
Signed-off-by: David Lechner <david@pybricks.com>
Diffstat (limited to 'docs/library')
| -rw-r--r-- | docs/library/btree.rst | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/docs/library/btree.rst b/docs/library/btree.rst index c093f970f..9d1dcf111 100644 --- a/docs/library/btree.rst +++ b/docs/library/btree.rst @@ -11,8 +11,9 @@ value, a database also supports efficient ordered range scans (retrieval of values with the keys in a given range). On the application interface side, BTree database work as close a possible to a way standard `dict` type works, one notable difference is that both keys and values must -be `bytes` objects (so, if you want to store objects of other types, you -need to serialize them to `bytes` first). +be `bytes`-like objects (so, if you want to store objects of other types, you +need to first serialize them to `str` or `bytes` or another type that supports +the buffer protocol). The module is based on the well-known BerkelyDB library, version 1.xx. |
