ImportError: DLL load failed while importing typevartuples: An Application Control policy has blocked this file.
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
從報告中所示的 Windows 11 pre-commit 設定以及 mypy/typevartuples.py 中的匯入失敗著手。使用 poetry run pre-commit run --all-files 重現,然後確定遭封鎖的 DLL 是由 mypy 還是其 pre-commit 環境產生或封裝的。完成的標準是確定原因,並建立儲存庫層級的修正或記錄在案的限制。
由索引模型根據 Issue 內容生成。
描述
Crash Report
On Windows 11 SAC flags mypy as having a security issues cause the publisher cannot be verified of one of the DLLs.
Traceback
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\bani5\.cache\pre-commit\repo6vsqreec\py_env-python3.13\Scripts\mypy.EXE\__main__.py", line 2, in <module>
from mypy.__main__ import console_entry
File "C:\Users\bani5\.cache\pre-commit\repo6vsqreec\py_env-python3.13\Lib\site-packages\mypy\__main__.py", line 9, in <module>
from mypy.main import main, process_options
File "mypy\main.py", line 17, in <module>
from mypy import build, defaults, state, util
File "mypy\build.py", line 33, in <module>
File "mypy\semanal_main.py", line 37, in <module>
from mypy.checker import FineGrainedDeferredNode
File "mypy\checker.py", line 23, in <module>
File "mypy\checkexpr.py", line 16, in <module>
from mypy import applytype, erasetype, join, message_registry, nodes, operators, types
File "mypy\applytype.py", line 6, in <module>
File "mypy\subtypes.py", line 9, in <module>
File "mypy\constraints.py", line 10, in <module>
import mypy.typeops
File "mypy\typeops.py", line 14, in <module>
from mypy.checker_state import checker_state
File "mypy\checker_state.py", line 7, in <module>
from mypy.checker_shared import TypeCheckerSharedApi
File "mypy\checker_shared.py", line 13, in <module>
from mypy.errors import ErrorWatcher
File "mypy\errors.py", line 18, in <module>
from mypy.types import Type
File "mypy\types.py", line 4425, in <module>
File "mypy\expandtype.py", line 44, in <module>
from mypy.typevartuples import split_with_instance
ImportError: DLL load failed while importing typevartuples: An Application Control policy has blocked this file.
To Reproduce
mypy is my last pre-commit hook and it fails.
poetry run pre-commit run --all-files
Your Environment
# `pre-commit install` (no flags) installs both the pre-commit and commit-msg git
# hooks, so the file checks/linters and the conventional-commit message check both run.
default_install_hook_types: [pre-commit, commit-msg]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-merge-conflict
- id: no-commit-to-branch
args: [ "--branch", "main", "--branch", "develop" ]
- id: check-toml
- id: check-json
- id: mixed-line-ending
- id: check-yaml
args: [ "--allow-multiple-documents" ]
- id: check-added-large-files
args: [ "--maxkb=500" ]
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: debug-statements
- id: name-tests-test
args: ['--pytest-test-first']
- id: requirements-txt-fixer
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.7
hooks:
- id: ruff
args:
- --fix
- --target-version=py313
- --line-length=120
- --select=E,F,I,B,C,W,UP,ARG,PERF,PL,RET,SIM,TID,ERA,PD,PGH,PT,PYI,RUF
- --ignore=E501,B008,PLR0913,ERA001
language_version: python3.13
- id: ruff-format
args:
- --target-version=py313
- --line-length=120
language_version: python3.13
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.19.1
hooks:
- id: mypy
args:
- --config-file=pyproject.toml
- --ignore-missing-imports
additional_dependencies:
- types-requests>=2.32.0
- types-tabulate>=0.9.0
- types-PyYAML>=6.0
- pydantic
- sqlalchemy[mypy]
language_version: python3.13
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v4.4.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args:
# `types` are positional arguments (not a --types flag); --scopes is an option.
- --scopes=api,db,config,test,docs,ci,infra,security,qa,orchestrator,worker,prompts
- feat
- fix
- docs
- style
- refactor
- test
- chore
- perf
- ci
- build
- revert
OS: Windows 11
- 主要語言
- Python
- 星號
- 20.7k
- 分支
- 3.3k
- 平均合併
- 1 天 20 小時
- 30 天內合併 PR
- 102
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
python/mypy 的其他 Issue
-
T-string below Python 3.14 also reports import-not-found for string.templatelib on line 1可能已有人在做 @jw9829 今天認領。 未關閉bug topic-parser
難度 2/5 1-3 小時 新手友好度 74/100
維護者通常 1 天內回覆
-
Regression in 2.4.0: empty constraint tuple in PEP 695 type parameter (`class C[T: ()]`) is no longer reported可能已有人在做 @CheerathAniketh 於 2 天前認領。 未關閉topic-parser topic-pep-695
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
`stubgen --inspect-mode` crashes with `AttributeError on PEP 604 union syntax (X | Y)` *(mypy 2.1.0)*可能已有人在做 @ayushdoesdev 於 69 天前認領。 未關閉bug
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆
-
Inconsistent description of `strict_optional`可能已有人在做 @Joosboy 於 86 天前認領。 未關閉documentation
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
相似的 Issue
-
bug
難度 1/5 1 小時以內 新手友好度 88/100
openwisp/openwisp-utils#777 ·
-
難度 2/5 1-3 小時 新手友好度 63/100
google-research/weatherbenchX#310 ·
維護者通常 3 天內回覆
-
`unload()` returns the trained `modules_to_save` copy instead of the original module可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
huggingface/peft#3955 ·
維護者通常 1 天內回覆
-
author-page correction
難度 2/5 1-3 小時 新手友好度 60/100
acl-org/acl-anthology#10313 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 76/100
AOSSIE-Org/Gitcord-GithubDiscordBot#147 · 1 則留言 ·
維護者通常 1 天內回覆