Version-gated early exits: `from copy import replace` is accepted but `copy.replace` is rejected
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 30/100
Hướng nghiên cứu
The repro is self-contained: with python_version 3.10, a sys.version_info < (3, 13) guard suppresses the error when the call sits in an else branch but not when the guard exits early via return. Start by finding where pyrefly applies version-gated narrowing to sys.version_info comparisons, likely in the binding/narrowing code under the type-checker crate, and compare how the early-return path and the else path propagate the refined flow. Done means both via_attribute and via_else from the report produce no missing-attribute, with a regression test covering the early-return form.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the Bug
with python_version 3.10
import copy
import sys
def via_attribute(x: object) -> object:
if sys.version_info < (3, 13):
return x
return copy.replace(x) # No attribute `replace` in module `copy` [missing-attribute]
def via_else(x: object) -> object:
if sys.version_info < (3, 13):
return x
else:
return copy.replace(x) # OK
ERROR sandbox.py:10:12-24: No attribute `replace` in module `copy` [[missing-attribute](https://pyrefly.org/en/docs/error-kinds/#missing-attribute)]
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
-
False positive: `Protocol` with `EXCLUDED_ATTRIBUTES` cannot be used with `issubclass()`Có thể đã có người làm @amas127 đã nhận hôm nay. Đang mởtypechecking
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 57/100
-
typechecking
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 57/100
-
configuration quansight
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 55/100
Tất cả issue của facebook/pyrefly
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/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 77/100
tauri-apps/plugins-workspace#3780 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
NVIDIA/spark-local-inference#268 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
datafusion-contrib/StreamFusion#653 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug CLI exec session
Độ 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