From e2ae4d8b3c490bd5288d7befe2d26cba6126c01d Mon Sep 17 00:00:00 2001 From: wanglin <2281216234@qq.com> Date: Sat, 3 Oct 2026 21:36:15 +0800 Subject: [PATCH] =?UTF-8?q?robustness:=20=5Fdump=5Fjson=20=E8=87=AA?= =?UTF-8?q?=E5=BB=BA=E7=88=B6=E7=9B=AE=E5=BD=95=EF=BC=88=E4=BF=AE=20R3=20?= =?UTF-8?q?=E8=A6=86=E7=9B=96=E7=9B=AE=E5=BD=95=E5=86=99=E5=85=A5=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E9=9D=99=E9=BB=98=E5=A4=B1=E6=95=88=EF=BC=89=EF=BC=9B?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=AB=AF=E5=88=B0=E7=AB=AF=20wrapper=20?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=2012=20=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- preflight.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/preflight.py b/preflight.py index d5a4c43..9607376 100644 --- a/preflight.py +++ b/preflight.py @@ -81,7 +81,15 @@ def _load_json(path): def _dump_json(obj, path): + """写 JSON 到覆盖目录;失败返回 False。 + + 自己负责把父目录建出来(不依赖调用方先前建过)——10-03 端到端测试出现过 + "覆盖目录建了但 tokenizer 子目录写不进去"导致 R3 静默失效,这里做成自洽。 + """ try: + parent = os.path.dirname(os.path.abspath(path)) + if parent: + os.makedirs(parent, exist_ok=True) with open(path, "w", encoding="utf-8") as f: json.dump(obj, f, ensure_ascii=False, indent=1) return True