provide a way to access the unmodified environment (variables) of a Python script

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

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

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
operating-systems

Hướng nghiên cứu

Không có tệp triển khai hay bài kiểm thử nào được nêu. Hãy bắt đầu với PEP 538 và cuộc thảo luận được liên kết trong issue 72367 để hiểu sự biến đổi môi trường và API được đề xuất; công việc hoàn tất khi một thiết kế cụ thể và phạm vi bao phủ tương ứng được thống nhất.

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

Mô tả

interpreter-core type-feature

Feature or enhancement

As described in https://github.com/python/cpython/issues/72367#issuecomment-1140355246 and the following comments, the implementation of PEP 538 makes it impossible to access the original unmodified environment (variables) with which a process have been invoked.

I have no problem with the goal of PEP 538 itself or the locale coercion, but this is a problem for any use-case the wants to act on the original locale.

Using PYTHONCOERCECLOCALE=0 is no solution either, as then this modifies the original locale and one couldn't decide whether it's just there to prevent Python's setting of LC_CTYPE=C or whether it was really intended to be in the environment suo jure.

Neither is it obviously a solution to use build-time options.

A solution could be to add another os.original_environment or something like that, which gives the true original environment, without any changes that Python itself may have made.

If Python would ever only modify (by itself) the environment with respect to LC_CTYPE and locale coercion, it could also be enough to simply give the program a way to find out whether that was done, and what the original value (or unset) of LC_CTYPE was.

Pitch

Example use cases are given in the previous discussion mentioned below.

In short, pretty much anything that is intended to serve as a wrapper could require the true original environment.
Imagine one would want to implement the POSIX env utility in Python.

Previous discussion

See https://github.com/python/cpython/issues/72367#issuecomment-1140355246 .

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.