gh-111841: Fix os.putenv() and os.unsetenv() with embedded NUL on Windows#111842
Conversation
|
It also makes |
vstinner
left a comment
There was a problem hiding this comment.
I don't understand this change. PyUnicode_AsWideCharString() should already implements the check and test_os has tests on embedded null characters in the env var name and in the env var value.
Lib/test/test_posix.py
Outdated
| import posix | ||
| except ImportError: | ||
| try: | ||
| import nt as posix |
There was a problem hiding this comment.
That's strange. For me, "test_posix" are tests for the POSIX platforms: all platforms but Windows.
If you want to write tests on alls platform including Windows, add tests to test_os, no?
There was a problem hiding this comment.
They are already written, and it turned out that they are compatible with Windows.
In the past there were several platform specific implementations: posix, nt, dos, os2, mac, ce. But posix and nt became so close that they are now build from the same source, and other implementations are gone.
I looked at the code and played with Python on Windows:
Oh ok, now I get it. Well, currently, OSError is raised at least. |
|
If you want to run test_posix on Windows, can you please do it in a separated PR? This PR is about embedded null characters and putenv(). Running test_posix on Windows is a significant change. |
Done. See #111913. |
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
|
GH-111966 is a backport of this pull request to the 3.12 branch. |
|
GH-111967 is a backport of this pull request to the 3.11 branch. |
…on Windows (pythonGH-111842) (cherry picked from commit 0b06d24) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
…on Windows (pythonGH-111842) (cherry picked from commit 0b06d24) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
Uh oh!
There was an error while loading. Please reload this page.