os.stat()’s follow_symlinks is a bit ambigously described

Đang mở
#96,402 4 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
48/100
Loại issue
Tài liệu
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
documentation

Hướng nghiên cứu

Bắt đầu với tài liệu về os.stat() và phần Files and Directories được liên kết. Làm rõ rằng follow_symlinks áp dụng cho thành phần cuối cùng của tên đường dẫn, sau đó kiểm tra và sửa, nếu cần, phần diễn đạt tương ứng cho Windows và mục Changed in; tài liệu phải mô tả chính xác cả hai hành vi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

docs

Documentation

There are numerous functions which take a pathname and and argument like follow_symlinks.

For most of these, the argument follow_symlinks is not further explained in the function itself, but people will rather have to resort to https://docs.python.org/3/library/os.html#files-and-directories where things are rather exactly described.

However, the description of os.stat() has:

This function normally follows symlinks; to stat a symlink add the argument follow_symlinks=False, or use lstat().

Which is however only half correct, because what it actually means is:

When the last component of the path is a symbolic link, the function normally follows it. Symbolic links in the path that are not the last component, are always followed.

Similar, the paragraph below for windows, also uses wording that implies any name-surrogate reparse points, i.e. not only if the last pathname component is one.
No idea what Windows does, but if that's also wrong, it should be corrected accordingly. Also in the "Changed in" entry for that.

AFAICS, the other functions of os have it correctly described (by simply not describing it).

Thanks,
Chris.

Ngôn ngữ chính
Python
Star
77.2k
Fork
36k
Merge trung bình
1 ngày 9 giờ
Pull request đã merge (30 ngày)
558

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của python/cpython

Tất cả issue của python/cpython

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.