Skip to content

Commit dbb9be6

Browse files
authored
Merge pull request python#5 from paulmon/win-arm32-ssl-fix
Win arm32 ssl fix
2 parents 1660c58 + f4b0a6b commit dbb9be6

File tree

9 files changed

+126
-204
lines changed

9 files changed

+126
-204
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ PCbuild/*.VC.opendb
7171
PCbuild/.vs/
7272
PCbuild/amd64/
7373
PCbuild/arm32/
74+
PCbuild/iot/
7475
PCbuild/obj/
7576
PCbuild/win32/
7677
.purify

Lib/test/test_ssl.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1319,7 +1319,7 @@ def test_load_verify_cadata(self):
13191319
with self.assertRaisesRegex(ssl.SSLError, "not enough data"):
13201320
ctx.load_verify_locations(cadata=b"broken")
13211321

1322-
1322+
@unittest.skipIf(platform.win32_editionId() == 'IoTUAP' and 'python_d' in sys.executable, "Crashes on debug python builds on Windows IoT Core")
13231323
def test_load_dh_params(self):
13241324
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
13251325
ctx.load_dh_params(DHFILE)
@@ -1621,6 +1621,7 @@ def test_str(self):
16211621
self.assertEqual(str(e), "foo")
16221622
self.assertEqual(e.errno, 1)
16231623

1624+
@unittest.skipIf(platform.win32_editionId() == 'IoTUAP' and 'python_d' in sys.executable, "Crashes on debug python builds on Windows IoT Core")
16241625
def test_lib_reason(self):
16251626
# Test the library and reason attributes
16261627
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
@@ -3725,6 +3726,7 @@ def test_compression_disabled(self):
37253726
sni_name=hostname)
37263727
self.assertIs(stats['compression'], None)
37273728

3729+
@unittest.skipIf(platform.win32_editionId() == 'IoTUAP' and 'python_d' in sys.executable, "Crashes on debug python builds on Windows IoT Core")
37283730
def test_dh_params(self):
37293731
# Check we can get a connection with ephemeral Diffie-Hellman
37303732
client_context, server_context, hostname = testing_context()

PCbuild/_freeze_importlib.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
<ImportGroup Label="ExtensionTargets">
106106
</ImportGroup>
107107
<Target Name="_RebuildImportLib">
108-
<Exec Command="&quot;$(TargetPath)&quot; &quot;%(None.FullPath)&quot; &quot;%(None.IntFile)&quot;" />
108+
<Exec Command="&quot;$(TargetPath)&quot; &quot;%(None.FullPath)&quot; &quot;%(None.IntFile)&quot;" Condition="'$(Platform)'!='ARM'"/>
109109
<PropertyGroup>
110110
<_OldContent Condition="Exists($(OutTargetPath))">
111111
</_OldContent>

PCbuild/_ssl.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
<ItemGroup>
8585
<ClCompile Include="..\Modules\_ssl.c" />
8686
<ClCompile Include="$(opensslIncludeDir)\applink.c">
87-
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;$(PreprocessorDefinitions)</PreprocessorDefinitions>
87+
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
8888
</ClCompile>
8989
</ItemGroup>
9090
<ItemGroup>

PCbuild/pcbuild.sln

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ Global
375375
{13CECB97-4119-4316-9D42-8534019A5A44}.Release|x64.ActiveCfg = Release|x64
376376
{13CECB97-4119-4316-9D42-8534019A5A44}.Release|x64.Build.0 = Release|x64
377377
{C6E20F84-3247-4AD6-B051-B073268F73BA}.Debug|ARM.ActiveCfg = Debug|ARM
378+
{C6E20F84-3247-4AD6-B051-B073268F73BA}.Debug|ARM.Build.0 = Debug|ARM
378379
{C6E20F84-3247-4AD6-B051-B073268F73BA}.Debug|Win32.ActiveCfg = Debug|Win32
379380
{C6E20F84-3247-4AD6-B051-B073268F73BA}.Debug|Win32.Build.0 = Debug|Win32
380381
{C6E20F84-3247-4AD6-B051-B073268F73BA}.Debug|x64.ActiveCfg = Debug|x64
@@ -601,6 +602,7 @@ Global
601602
{EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Release|Win32.ActiveCfg = Release|Win32
602603
{EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Release|x64.ActiveCfg = Release|x64
603604
{447F05A8-F581-4CAC-A466-5AC7936E207E}.Debug|ARM.ActiveCfg = Debug|ARM
605+
{447F05A8-F581-4CAC-A466-5AC7936E207E}.Debug|ARM.Build.0 = Debug|ARM
604606
{447F05A8-F581-4CAC-A466-5AC7936E207E}.Debug|Win32.ActiveCfg = Debug|Win32
605607
{447F05A8-F581-4CAC-A466-5AC7936E207E}.Debug|Win32.Build.0 = Debug|Win32
606608
{447F05A8-F581-4CAC-A466-5AC7936E207E}.Debug|x64.ActiveCfg = Debug|x64
@@ -786,6 +788,7 @@ Global
786788
{1D4B18D3-7C12-4ECB-9179-8531FF876CE6}.Release|x64.ActiveCfg = Release|x64
787789
{1D4B18D3-7C12-4ECB-9179-8531FF876CE6}.Release|x64.Build.0 = Release|x64
788790
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Debug|ARM.ActiveCfg = Debug|ARM
791+
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Debug|ARM.Build.0 = Debug|ARM
789792
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Debug|Win32.ActiveCfg = Debug|Win32
790793
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Debug|x64.ActiveCfg = Debug|x64
791794
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.PGInstrument|ARM.ActiveCfg = PGInstrument|ARM
@@ -795,6 +798,7 @@ Global
795798
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.PGUpdate|Win32.ActiveCfg = Release|Win32
796799
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.PGUpdate|x64.ActiveCfg = Release|Win32
797800
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Release|ARM.ActiveCfg = Release|ARM
801+
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Release|ARM.Build.0 = Release|ARM
798802
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Release|Win32.ActiveCfg = Release|Win32
799803
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Release|Win32.Build.0 = Release|Win32
800804
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Release|x64.ActiveCfg = Release|x64

Python/ceval.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,10 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
547547
return tstate->interp->eval_frame(f, throwflag);
548548
}
549549

550+
#ifdef _M_ARM
551+
#pragma optimize ("", off)
552+
#endif // _M_ARM
553+
550554
PyObject* _Py_HOT_FUNCTION
551555
_PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
552556
{
@@ -3500,6 +3504,10 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
35003504
return _Py_CheckFunctionResult(NULL, retval, "PyEval_EvalFrameEx");
35013505
}
35023506

3507+
#ifdef _M_ARM
3508+
#pragma optimize ("", on)
3509+
#endif // _M_ARM
3510+
35033511
static void
35043512
format_missing(const char *kind, PyCodeObject *co, PyObject *names)
35053513
{

Tools/winiot/build.bat

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,29 @@
22
setlocal
33
set D=%~dp0
44
set PCBUILD=%D%..\..\PCbuild\
5+
set PYTHON_EXE=%PCBUILD%..\externals\pythonx86\tools\python.exe
56
if "%Py_OutDir%"=="" set Py_OutDir=%PCBUILD%
67

78
set BUILDX86=
89
set BUILDX64=
910
set BUILDARM=
10-
set SYNCX86=
11-
set SYNCX64=
12-
set SYNCARM=
1311
set REBUILD=
14-
set OUTPUT=
15-
set PACKAGES=
1612
set DEBUG=
17-
set DEBUG_SUFFIX=
13+
set TEST=
14+
set _SUFFIX=
1815

1916
:CheckOpts
2017
if "%~1" EQU "-h" goto Help
21-
if "%~1" EQU "-x86" (set BUILDX86=1 && set SYNCX86=1) && shift && goto CheckOpts
22-
if "%~1" EQU "-x64" (set BUILDX64=1 && set SYNCX64=1) && shift && goto CheckOpts
23-
if "%~1" EQU "-arm" (set BUILDARM=1 && set SYNCARM=1) && shift && goto CheckOpts
18+
if "%~1" EQU "-x86" (set BUILDX86=1) && shift && goto CheckOpts
19+
if "%~1" EQU "-x64" (set BUILDX64=1) && shift && goto CheckOpts
20+
if "%~1" EQU "-arm" (set BUILDARM=1) && shift && goto CheckOpts
21+
if "%~1" EQU "-t" (set TEST=-t) && shift && goto CheckOpts
2422
if "%~1" EQU "-r" (set REBUILD=-r) && shift && goto CheckOpts
2523
if "%~1" EQU "-d" (set DEBUG=-d && set _SUFFIX=_d) && shift && goto CheckOpts
26-
if "%~1" EQU "-o" (set OUTPUT="/p:OutputPath=%~2") && shift && shift && goto CheckOpts
27-
if "%~1" EQU "--out" (set OUTPUT="/p:OutputPath=%~2") && shift && shift && goto CheckOpts
28-
if "%~1" EQU "-p" (set PACKAGES=%PACKAGES% %~2) && shift && shift && goto CheckOpts
2924
if "%~1" NEQ "" echo Unknown parameter "%~1" && exit
3025

3126
if not defined BUILDX86 if not defined BUILDX64 if not defined BUILDARM (set BUILDX86=1) && (set BUILDX64=1) && (set BUILDARM=1)
3227

33-
:: need x64 python.exe to run sync_win_iot.pl when only building for ARM
34-
if defined BUILDARM (
35-
if not exist "%PCBUILD%amd64\python.exe" ( set BUILDX64=1 )
36-
)
37-
3828
call "%PCBUILD%find_msbuild.bat" %MSBUILD%
3929
if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2)
4030

@@ -45,29 +35,26 @@ if defined DEBUG (set CONFIGURATION=Debug
4535

4636
if defined BUILDX86 (
4737
if defined REBUILD ( call "%PCBUILD%build.bat" -e -r
48-
) else if not exist "%Py_OutDir%win32\python.exe" call "%PCBUILD%build.bat" -e %DEBUG%
38+
) else if not exist "%Py_OutDir%win32\python%_SUFFIX%.exe" call "%PCBUILD%build.bat" -e %DEBUG%
4939
if errorlevel 1 goto :eof
5040

51-
if defined SYNCX86 ( %MSBUILD% "%D%sync_win_iot.proj" /p:Configuration=%CONFIGURATION% /p:Platform=x86 %OUTPUT% %PACKAGES% %WINIOT% )
52-
if errorlevel 1 goto :eof
41+
%PYTHON_EXE% %D%sync_win_iot.py %DEBUG% %TEST% -p win32
5342
)
5443

5544
if defined BUILDX64 (
5645
if defined REBUILD ( call "%PCBUILD%build.bat" -p x64 -e -r
57-
) else if not exist "%Py_OutDir%amd64\python.exe" call "%PCBUILD%build.bat" -p x64 -e %DEBUG%
46+
) else if not exist "%Py_OutDir%amd64\python%_SUFFIX%.exe" call "%PCBUILD%build.bat" -p x64 -e %DEBUG%
5847
if errorlevel 1 goto :eof
5948

60-
if defined SYNCX64 ( %MSBUILD% "%D%sync_win_iot.proj" /p:Configuration=%CONFIGURATION% /p:Platform=x64 %OUTPUT% %PACKAGES% %WINIOT% )
61-
if errorlevel 1 goto :eof
49+
%PYTHON_EXE% %D%sync_win_iot.py %DEBUG% %TEST% -p amd64
6250
)
6351

6452
if defined BUILDARM (
65-
if defined REBUILD ( call "%PCBUILD%build.bat" -p ARM -e %DEBUG% -r --no-tkinter --no-ssl --no-vs
66-
) else if not exist "%Py_OutDir%arm32\python%_SUFFIX%.exe" call "%PCBUILD%build.bat" -p ARM -e %DEBUG% --no-tkinter --no-vs
53+
if defined REBUILD ( call "%PCBUILD%build.bat" -p ARM -e %DEBUG% -r --no-tkinter --no-vs
54+
) else if not exist "%Py_OutDir%arm32\python%_SUFFIX%.exe" call "%PCBUILD%build.bat" -p ARM -E %DEBUG% --no-tkinter --no-vs
6755
if errorlevel 1 goto :eof
6856

69-
if defined SYNCARM ( %MSBUILD% "%D%sync_win_iot.proj" /p:Configuration=%CONFIGURATION% /p:Platform=ARM /p:"PythonExe=%PCBUILD%amd64\python.exe" %OUTPUT% %PACKAGES% %WINIOT% )
70-
if errorlevel 1 goto :eof
57+
%PYTHON_EXE% %D%sync_win_iot.py %DEBUG% %TEST% -p arm32
7158
)
7259

7360
exit /B 0
@@ -78,7 +65,7 @@ echo.
7865
echo -x86 Build and sync x86 files
7966
echo -x64 Build and sync x64 files
8067
echo -arm Build and sync arm files (will build X64 to execute tools)
68+
echo -t Include test files
8169
echo -d Build Debug configuration
8270
echo -r Rebuild rather than incremental build
83-
echo --out [DIR] Override output directory
8471
echo -h Show usage

Tools/winiot/sync_win_iot.proj

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)