fix: 修复 Windows 上 resource 模块导入错误

This commit is contained in:
xiaoli-cli committed 2026-04-25 22:45:40 +08:00
1 parent 623e550e84
commit d819502b00
2 files changed
+7 -8

No files matched your search

+6 -2
View File
@@ -4,9 +4,13 @@ import ast as _ast
import re
import textwrap as _textwrap
import tempfile as _tempfile
import resource as _resource_mod
_HAS_RESOURCE = hasattr(_resource_mod, 'setrlimit')
try:
import resource as _resource_mod
_HAS_RESOURCE = hasattr(_resource_mod, 'setrlimit')
except ImportError:
_resource_mod = None
_HAS_RESOURCE = False
_BLOCKED_MODULES = frozenset({
'os', 'sys', 'subprocess', 'shutil', 'socket', 'pickle',