Commit d94e4e2
committed
python: update KVS api to work with modern KVS
Problem: The KVS python interface writes all data to the KVS in
JSON and reads all data back assuming it is formatted in JSON. This
appears to be legacy implementation from the days that all data in
the KVS was required to be formatted in JSON.
There are still some benefits to doing this, for example Python
lists/dicts can be written/read back easily. However, there are clear
problems with this, most notably data written in non-JSON format cannot
be read from the KVS via the Python interface at all.
Solution: With the goal of not breaking current code, support
the following compromise. If data that is read back is not in JSON
format, return it as a string if all the data is UTF-8 valid. If it is
not UTF-8 valid, return it in a Python bytes object. If data cannot
be written in JSON, write it as binary data if the data is a bytes object.
Fixes #51981 parent a1fe4dd commit d94e4e2
1 file changed
+15
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
39 | 44 | | |
40 | 45 | | |
41 | 46 | | |
| |||
78 | 83 | | |
79 | 84 | | |
80 | 85 | | |
81 | | - | |
82 | 86 | | |
83 | 87 | | |
84 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
85 | 97 | | |
86 | 98 | | |
87 | 99 | | |
| |||
0 commit comments