From 0f092d1c90c52392f1202b27550d322e5da35700 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Sun, 3 Dec 2023 14:03:15 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20|=20=E6=8F=90=E7=A4=BA=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E7=9A=84toml=E8=A7=A3=E6=9E=90=E5=99=A8=E9=87=8C=E5=B8=A6?= =?UTF-8?q?=E6=A0=87=E5=87=86=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib_not_dr/nuitka/reader/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib_not_dr/nuitka/reader/__init__.py b/src/lib_not_dr/nuitka/reader/__init__.py index f8de0c3..4f71df0 100644 --- a/src/lib_not_dr/nuitka/reader/__init__.py +++ b/src/lib_not_dr/nuitka/reader/__init__.py @@ -56,7 +56,8 @@ python lndl-nuitka.py (直接运行 会使用当前目录) """ TOML_READERS = ( - "tomllib", # stdlib toml reader after python 3.11 + # "tomllib", # stdlib toml reader after python 3.11 + # try tomllib first "toml", # slow pure python toml reader "rtoml", # rust based toml reader "tomlkit", # pure python toml reader @@ -67,6 +68,10 @@ TOML_READERS = ( def get_toml_reader(): + # 3.11 + 使用 tomllib + if sys.version_info >= (3, 11): + from tomllib import loads + return loads for module_name in TOML_READERS: try: loaded = __import__(module_name).loads