Deprecation warnings are not emitted when the deprecated decorator is imported with an alias
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 68/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- testing-qa
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Rust
- Star
- 7.2k
- Fork
- 578
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của facebook/pyrefly
-
pytorch tensor-shapes typechecking
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
good first issue typechecking
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
cargo b warning: unused dependency `zstd`Có thể đã có người làm @Narendersingh007 đã nhận 4 ngày trước. Đang mởgood first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
-
pydantic
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Tất cả issue của facebook/pyrefly
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
eventflux-io/eventflux#203 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug ui
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
userFRM/egui-charts#4068 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
fuzz-crash review-followup
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
marketing
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
aws/aws-emulator#610 ·