This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2020年01月21日 14:39 by vstinner, last changed 2022年04月11日 14:59 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 18104 | merged | vstinner, 2020年01月21日 14:53 | |
| PR 18107 | closed | vstinner, 2020年01月21日 18:30 | |
| PR 18108 | merged | vstinner, 2020年01月21日 18:32 | |
| PR 18114 | merged | miss-islington, 2020年01月22日 12:51 | |
| PR 18115 | closed | vstinner, 2020年01月22日 13:07 | |
| PR 18124 | merged | vstinner, 2020年01月22日 19:50 | |
| PR 18163 | merged | vstinner, 2020年01月24日 10:08 | |
| Messages (10) | |||
|---|---|---|---|
| msg360402 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2020年01月21日 14:39 | |
os.unsetenv() is documented to be available on Windows, but it's not. In Python 3.8, "del os.environ[key]" is implemented as: os.putenv(key.upper(), "") Attached PR implements it using SetEnvironmentVariableW(name, NULL). |
|||
| msg360403 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2020年01月21日 15:13 | |
New changeset 56cd3710a1ea3ba872d345ea1bebc86ed08bc8b8 by Victor Stinner in branch 'master': bpo-39413: Implement os.unsetenv() on Windows (GH-18104) https://github.com/python/cpython/commit/56cd3710a1ea3ba872d345ea1bebc86ed08bc8b8 |
|||
| msg360404 - (view) | Author: Eryk Sun (eryksun) * (Python triager) | Date: 2020年01月21日 15:27 | |
This bypasses the CRT's copy of the environment. If any C code calls [_w]getenv, it will still see the variable defined. The only way it won't is if setting the value also bypassed the CRT environment by directly calling SetEnvironmentVariableW. |
|||
| msg360418 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2020年01月21日 18:04 | |
> This bypasses the CRT's copy of the environment. If any C code calls [_w]getenv, it will still see the variable defined. The only way it won't is if setting the value also bypassed the CRT environment by directly calling SetEnvironmentVariableW. Oh. That's a valid concern. I reopen the issue. |
|||
| msg360420 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2020年01月21日 18:16 | |
I checked the doc: _putenv("VAR=") removes the environment variable "VAR". It's well documented:
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/putenv-wputenv?view=vs-2019
"You can remove a variable from the environment by specifying an empty value_string, or in other words, by specifying only varname=."
So Python 3.8 os._unsetenv() is correct, but this function was not exposed, and so this issue remains relevant: Python 3.8 documents that os.unsetenv() is available on Windows, but it's not.
|
|||
| msg360423 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2020年01月21日 18:31 | |
PR 18107 still fix this issue (add os.unsetenv() to Python 3.9 on Windows), but fix the implementation (use _wputenv() rather than SetEnvironmentVariableW(), to update the CRT). |
|||
| msg360462 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2020年01月22日 12:50 | |
New changeset f84f65be5602e561fef04b66bb487fbc4e560db5 by Victor Stinner in branch '3.8': bpo-39413: os.unsetenv() is not available on Windows (GH-18108) https://github.com/python/cpython/commit/f84f65be5602e561fef04b66bb487fbc4e560db5 |
|||
| msg360463 - (view) | Author: miss-islington (miss-islington) | Date: 2020年01月22日 12:56 | |
New changeset 570724667d37fcb160cdef2b34190dc36e28155c by Miss Islington (bot) in branch '3.7': bpo-39413: os.unsetenv() is not available on Windows (GH-18108) https://github.com/python/cpython/commit/570724667d37fcb160cdef2b34190dc36e28155c |
|||
| msg360503 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2020年01月22日 20:11 | |
New changeset b73dd02ea744288831f71363a7467552c09875ea by Victor Stinner in branch 'master': Revert "bpo-39413: Implement os.unsetenv() on Windows (GH-18104)" (GH-18124) https://github.com/python/cpython/commit/b73dd02ea744288831f71363a7467552c09875ea |
|||
| msg360609 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2020年01月24日 10:53 | |
New changeset 161e7b36b1ea871a1352ccfc1d4f4c1eda76830f by Victor Stinner in branch 'master': bpo-39413: Implement os.unsetenv() on Windows (GH-18163) https://github.com/python/cpython/commit/161e7b36b1ea871a1352ccfc1d4f4c1eda76830f |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:59:25 | admin | set | github: 83594 |
| 2020年01月28日 02:08:26 | vstinner | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2020年01月24日 10:53:48 | vstinner | set | messages: + msg360609 |
| 2020年01月24日 10:08:03 | vstinner | set | pull_requests: + pull_request17550 |
| 2020年01月22日 20:11:20 | vstinner | set | messages: + msg360503 |
| 2020年01月22日 19:50:21 | vstinner | set | pull_requests: + pull_request17511 |
| 2020年01月22日 13:07:13 | vstinner | set | pull_requests: + pull_request17502 |
| 2020年01月22日 12:56:26 | miss-islington | set | nosy:
+ miss-islington messages: + msg360463 |
| 2020年01月22日 12:51:13 | miss-islington | set | pull_requests: + pull_request17501 |
| 2020年01月22日 12:50:46 | vstinner | set | messages: + msg360462 |
| 2020年01月21日 18:32:37 | vstinner | set | pull_requests: + pull_request17497 |
| 2020年01月21日 18:31:10 | vstinner | set | messages: + msg360423 |
| 2020年01月21日 18:30:04 | vstinner | set | stage: resolved -> patch review pull_requests: + pull_request17496 |
| 2020年01月21日 18:16:30 | vstinner | set | messages: + msg360420 |
| 2020年01月21日 18:04:18 | vstinner | set | status: closed -> open resolution: fixed -> (no value) messages: + msg360418 |
| 2020年01月21日 15:27:01 | eryksun | set | nosy:
+ eryksun messages: + msg360404 |
| 2020年01月21日 15:16:51 | vstinner | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2020年01月21日 15:13:18 | vstinner | set | messages: + msg360403 |
| 2020年01月21日 14:53:09 | vstinner | set | keywords:
+ patch stage: patch review pull_requests: + pull_request17492 |
| 2020年01月21日 14:39:20 | vstinner | create | |