Deprecation warnings are not emitted when the deprecated decorator is imported with an alias
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 68/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 领域
- testing-qa
调研方向
Start by tracing how Pyrefly recognizes the standard library's warnings.deprecated decorator and how imported names are resolved; the issue does not name source files or tests. Reproduce the behavior with the provided scratch.py example and uvx pyrefly check --min-severity warn. Done means the aliased import produces the deprecation warning for old_func() while the unaliased case still works.
由索引模型根据 Issue 内容生成。
描述
Describe the Bug
Pyrefly does not emit deprecated diagnostics when the deprecated decorator from the standard library's warnings module is imported using an alias.
The same code produces the expected warning when the decorator is imported without an alias.
Steps to reproduce
Create a file named scratch.py:
from warnings import deprecated as _deprecated
@_deprecated("Use new_func instead")
def old_func() -> None:
pass
old_func()
Run:
uvx pyrefly check --min-severity warn
Expected behavior
Pyrefly should report a deprecation warning for the call to old_func().
Actual behavior
No deprecation warning is reported.
Additional information
Removing the alias makes the warning appear:
from warnings import deprecated
@deprecated("Use new_func instead")
def old_func() -> None:
pass
old_func()
Tested with Pyrefly 1.5.0.
Sandbox Link
(Only applicable for extension issues) IDE Information
No response
- 主要语言
- Rust
- 星标
- 7.2k
- 派生
- 578
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
facebook/pyrefly 的其他 Issue
-
pytorch tensor-shapes typechecking
难度 2/5 1-3 小时 新手友好度 70/100
-
good first issue typechecking
难度 2/5 1-3 小时 新手友好度 68/100
-
cargo b warning: unused dependency `zstd`可能已有人在做 @Narendersingh007 于 4 天前认领。 未关闭good first issue
难度 1/5 1 小时以内 新手友好度 88/100
-
难度 4/5 3-5 天 新手友好度 30/100
-
pydantic
难度 4/5 3-5 天 新手友好度 35/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 62/100
eventflux-io/eventflux#203 ·
维护者通常 1 天内回复
-
bug ui
难度 2/5 1-3 小时 新手友好度 72/100
userFRM/egui-charts#4068 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 82/100
trezor/trezor-firmware#8357 ·
维护者通常 2 天内回复
-
fuzz-crash review-followup
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复