Compare commits

..

3 Commits

Author SHA1 Message Date
Kanika Kapoor
bfb44e8618
Merge c048ec9faf4bfe02da004dce69471897933c3617 into e650904788e5ffd14118d7b78140df8fa2794687 2026-02-15 22:07:37 +05:30
blueloveTH
e650904788 fix a minor bug 2026-02-14 13:01:23 +08:00
blueloveTH
f6c6a48de4 fix #461 2026-02-10 11:23:13 +08:00
2 changed files with 13 additions and 1 deletions

View File

@ -104,7 +104,9 @@ 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");
c11_sv sv = py_tosv(k);
mpack_write_str(writer, sv.data, (size_t)sv.size);
return py_to_mpack(v, writer);
bool ok = 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) {

View File

@ -5,6 +5,16 @@ label: json
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
:::code source="../../include/typings/json.pyi" :::