mirror of
https://github.com/pocketpy/pocketpy
synced 2026-03-24 06:00:25 +00:00
Compare commits
1 Commits
bfb44e8618
...
87c60a688a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
87c60a688a |
@ -104,9 +104,7 @@ static bool mpack_write_dict_kv(py_Ref k, py_Ref v, void* ctx) {
|
|||||||
if(k->type != tp_str) return TypeError("msgpack: key must be strings");
|
if(k->type != tp_str) return TypeError("msgpack: key must be strings");
|
||||||
c11_sv sv = py_tosv(k);
|
c11_sv sv = py_tosv(k);
|
||||||
mpack_write_str(writer, sv.data, (size_t)sv.size);
|
mpack_write_str(writer, sv.data, (size_t)sv.size);
|
||||||
bool ok = py_to_mpack(v, writer);
|
return py_to_mpack(v, writer);
|
||||||
if(!ok) mpack_write_nil(writer);
|
|
||||||
return ok;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool py_to_mpack(py_Ref object, mpack_writer_t* writer) {
|
static bool py_to_mpack(py_Ref object, mpack_writer_t* writer) {
|
||||||
|
|||||||
@ -5,16 +5,6 @@ label: json
|
|||||||
|
|
||||||
JSON serialization and deserialization module.
|
JSON serialization and deserialization module.
|
||||||
|
|
||||||
This module is not safe. You may not want to use it with untrusted data.
|
|
||||||
If you need a safe alternative, consider a 3rd-party library like `cjson`.
|
|
||||||
|
|
||||||
You can override the json functions with:
|
|
||||||
```c
|
|
||||||
py_GlobalRef mod = py_getmodule("json");
|
|
||||||
py_bindfunc(mod, "loads", _safe_json_loads);
|
|
||||||
py_bindfunc(mod, "dumps", _safe_json_dumps);
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Source code
|
#### Source code
|
||||||
|
|
||||||
:::code source="../../include/typings/json.pyi" :::
|
:::code source="../../include/typings/json.pyi" :::
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user