[mozprocess] "ValueError: embedded null character" on Windows with Python 3
Categories
(Testing :: Mozbase, defect, P2)
Tracking
(Not tracked)
People
(Reporter: ahal, Assigned: ahal)
References
Details
Attachments
(3 files)
This happens due to a regression in Python itself:
https://bugs.python.org/issue32745
This gets raised by LPCWSTR
here:
https://searchfox.org/mozilla-central/source/testing/mozbase/mozprocess/mozprocess/winprocess.py#167
However according to the winapi docs the format needs to be:
key=value\0
So in other words, CreateProcess
is expecting null characters, but ctypes' LPCWSTR
now prohibits them. I haven't found a workaround yet.
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 1•5 years ago
|
||
Turns out we had already discovered this issue and the tests are all skipped on Python 3 under Windows because of it:
https://searchfox.org/mozilla-central/source/testing/mozbase/mozprocess/tests/manifest.ini#3
Assignee | ||
Comment 2•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 4•5 years ago
|
||
This works around a bug in Python:
https://bugs.python.org/issue32745
Null characters aren't allowed in 'c_wchar_p' types anymore, but we can get around
the issue by allocating a buffer in memory and casting it after the fact. This was
discovered via trial and error and I'm not really sure why it works.. But it does.
This also enables the tests under Python 3 on Windows (which thankfully all
seem to pass).
Comment 5•5 years ago
|
||
bugherder |
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 6•5 years ago
|
||
Depends on D48113
Comment 8•5 years ago
|
||
bugherder |
Assignee | ||
Updated•5 years ago
|
Updated•5 years ago
|
Description
•