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.

Title: Build _testembed on Windows
Type: enhancement Stage: resolved
Components: Tests, Windows Versions: Python 3.4
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: brian.curtin, loewis, ncoghlan, pitrou, python-dev, tim.golden, zach.ware
Priority: normal Keywords: patch

Created on 2013-10-29 20:58 by zach.ware, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit
windows_testembed.diff zach.ware, 2013-10-29 20:58 Build _testembed on Windows review
issue19439.v2.diff zach.ware, 2013-11-03 06:20 Match pipe encoding review
Messages (7)
msg201671 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2013-10-29 20:58
Here's a patch that builds _testembed on Windows and adjusts test_capi to not skip EmbeddingTests on Windows.  The .vcxproj is based on _freeze_importlib, with "when to build" settings lifted from _testimportmultiple.

The patch also adjusts test_capi.EmbeddingTests.test_forced_io_encoding such that it doesn't blow up completely on Windows (and should still pass anywhere it does currently, though I haven't been able to test anywhere but on Windows yet).  The test still fails, though; here's the relevant output I get:

FAIL: test_forced_io_encoding (test.test_capi.EmbeddingTests)
Traceback (most recent call last):
  File "P:\Projects\OSS\Python\_cpython\lib\test\", line 298, in test_forced_io_encoding
    self.assertEqual(out.strip(), expected_output)
AssertionError: '--- [106 chars]t: cp1252:strict\r\nstderr: cp1252:backslashre[575 chars]lace' != '--- [106 chars]t: cp437:strict\r\nstderr:
 cp437:backslashrepl[571 chars]lace'
  --- Use defaults ---
  Expected encoding: default
  Expected errors: default
  stdin: cp437:strict
- stdout: cp1252:strict
?           ^^^^
+ stdout: cp437:strict
?           ^^^
- stderr: cp1252:backslashreplace
?           ^^^^
+ stderr: cp437:backslashreplace
?           ^^^
  --- Set errors only ---
  Expected encoding: default
  Expected errors: surrogateescape
  stdin: cp437:surrogateescape
- stdout: cp1252:surrogateescape
?           ^^^^
+ stdout: cp437:surrogateescape
?           ^^^
- stderr: cp1252:backslashreplace
?           ^^^^
+ stderr: cp437:backslashreplace
?           ^^^
  --- Set encoding only ---
  Expected encoding: latin-1
  Expected errors: default
  stdin: latin-1:strict
  stdout: latin-1:strict
  stderr: latin-1:backslashreplace
  --- Set encoding and errors ---
  Expected encoding: latin-1
  Expected errors: surrogateescape
  stdin: latin-1:surrogateescape
  stdout: latin-1:surrogateescape
  stderr: latin-1:backslashreplace


I'm not sure whether this is a bug in the way _testembed is built or otherwise.  EmbeddingTests.test_subinterps passes, though.

Due to my ongoing inability to get a 64-bit build to work, this has only been tested on 32-bit Windows 7.
msg201674 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2013-10-29 21:18
Nice! I wonder if there might a difference between the default console
encoding and the default pipe encoding (that test assumes the default
standard stream encodings will be the same in the current process as they
are in the child).
msg201911 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2013-11-01 15:52
That appears to be the case:

P:\Projects\OSS\Python\cpython\ $ chcp
Active code page: 437

P:\Projects\OSS\Python\cpython\ $ PCbuild\python_d.exe
Python 3.4.0a4+ (default:995173ed248a+, Nov  1 2013, 09:12:43) [MSC v.1600 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os, sys
>>> rfd, wfd = os.pipe()
>>> r = os.fdopen(rfd, 'r')
>>> w = os.fdopen(wfd, 'w')
>>> sys.stdin.encoding, sys.stdout.encoding
('cp437', 'cp437')
>>> r.encoding, w.encoding
('cp1252', 'cp1252')

The test passes as patched if I do 'chcp 1252' before running.  Is it reasonable to patch the test to expect the default stdout and stderr encoding to equal ``os.fdopen(os.pipe[1], 'w').encoding``?  Doing so passes on Windows, don't know about various Unixes.
msg201996 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2013-11-03 06:20
This patch's changes to test_capi seem to work for Windows and keeps at least Gentoo and FreeBSD 10 happy.
msg201999 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-11-03 06:54
New changeset c8c6c007ade3 by Nick Coghlan in branch 'default':
Close #19439: execute embedding tests on Windows
msg202000 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2013-11-03 06:56
I checked that test_capi still passed on Fedora as well.

Only tweak I made before committing was to ensure that the read end of the test pipe used to determine the default pipe encoding was also closed.
msg202254 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-11-06 04:03
New changeset 99640494ca7f by Zachary Ware in branch 'default':
#19439: Update PCbuild/readme.txt with new sub-project
Date User Action Args
2022-04-11 14:57:52adminsetgithub: 63638
2013-11-06 04:03:51python-devsetmessages: + msg202254
2013-11-03 06:57:07ncoghlansetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2013-11-03 06:56:48ncoghlansetstatus: closed -> open
resolution: fixed -> (no value)
messages: + msg202000

stage: resolved -> patch review
2013-11-03 06:54:59python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg201999

resolution: fixed
stage: patch review -> resolved
2013-11-03 06:20:18zach.waresetfiles: + issue19439.v2.diff

messages: + msg201996
stage: patch review
2013-11-01 15:52:50zach.waresetmessages: + msg201911
2013-10-29 21:18:11ncoghlansetmessages: + msg201674
2013-10-29 20:58:13zach.warecreate