Skip to content

Commit

Permalink
Merge pull request python#5 from paulmon/win-arm32-ssl-fix
Browse files Browse the repository at this point in the history
Win arm32 ssl fix
  • Loading branch information
paulmon authored Sep 27, 2018
2 parents 1660c58 + f4b0a6b commit dbb9be6
Show file tree
Hide file tree
Showing 9 changed files with 126 additions and 204 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ PCbuild/*.VC.opendb
PCbuild/.vs/
PCbuild/amd64/
PCbuild/arm32/
PCbuild/iot/
PCbuild/obj/
PCbuild/win32/
.purify
Expand Down
4 changes: 3 additions & 1 deletion Lib/test/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,7 @@ def test_load_verify_cadata(self):
with self.assertRaisesRegex(ssl.SSLError, "not enough data"):
ctx.load_verify_locations(cadata=b"broken")


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

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

@unittest.skipIf(platform.win32_editionId() == 'IoTUAP' and 'python_d' in sys.executable, "Crashes on debug python builds on Windows IoT Core")
def test_dh_params(self):
# Check we can get a connection with ephemeral Diffie-Hellman
client_context, server_context, hostname = testing_context()
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/_freeze_importlib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<Target Name="_RebuildImportLib">
<Exec Command="&quot;$(TargetPath)&quot; &quot;%(None.FullPath)&quot; &quot;%(None.IntFile)&quot;" />
<Exec Command="&quot;$(TargetPath)&quot; &quot;%(None.FullPath)&quot; &quot;%(None.IntFile)&quot;" Condition="'$(Platform)'!='ARM'"/>
<PropertyGroup>
<_OldContent Condition="Exists($(OutTargetPath))">
</_OldContent>
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/_ssl.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<ItemGroup>
<ClCompile Include="..\Modules\_ssl.c" />
<ClCompile Include="$(opensslIncludeDir)\applink.c">
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;$(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemGroup>
<ItemGroup>
Expand Down
4 changes: 4 additions & 0 deletions PCbuild/pcbuild.sln
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ Global
{13CECB97-4119-4316-9D42-8534019A5A44}.Release|x64.ActiveCfg = Release|x64
{13CECB97-4119-4316-9D42-8534019A5A44}.Release|x64.Build.0 = Release|x64
{C6E20F84-3247-4AD6-B051-B073268F73BA}.Debug|ARM.ActiveCfg = Debug|ARM
{C6E20F84-3247-4AD6-B051-B073268F73BA}.Debug|ARM.Build.0 = Debug|ARM
{C6E20F84-3247-4AD6-B051-B073268F73BA}.Debug|Win32.ActiveCfg = Debug|Win32
{C6E20F84-3247-4AD6-B051-B073268F73BA}.Debug|Win32.Build.0 = Debug|Win32
{C6E20F84-3247-4AD6-B051-B073268F73BA}.Debug|x64.ActiveCfg = Debug|x64
Expand Down Expand Up @@ -601,6 +602,7 @@ Global
{EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Release|Win32.ActiveCfg = Release|Win32
{EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Release|x64.ActiveCfg = Release|x64
{447F05A8-F581-4CAC-A466-5AC7936E207E}.Debug|ARM.ActiveCfg = Debug|ARM
{447F05A8-F581-4CAC-A466-5AC7936E207E}.Debug|ARM.Build.0 = Debug|ARM
{447F05A8-F581-4CAC-A466-5AC7936E207E}.Debug|Win32.ActiveCfg = Debug|Win32
{447F05A8-F581-4CAC-A466-5AC7936E207E}.Debug|Win32.Build.0 = Debug|Win32
{447F05A8-F581-4CAC-A466-5AC7936E207E}.Debug|x64.ActiveCfg = Debug|x64
Expand Down Expand Up @@ -786,6 +788,7 @@ Global
{1D4B18D3-7C12-4ECB-9179-8531FF876CE6}.Release|x64.ActiveCfg = Release|x64
{1D4B18D3-7C12-4ECB-9179-8531FF876CE6}.Release|x64.Build.0 = Release|x64
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Debug|ARM.ActiveCfg = Debug|ARM
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Debug|ARM.Build.0 = Debug|ARM
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Debug|Win32.ActiveCfg = Debug|Win32
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Debug|x64.ActiveCfg = Debug|x64
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.PGInstrument|ARM.ActiveCfg = PGInstrument|ARM
Expand All @@ -795,6 +798,7 @@ Global
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.PGUpdate|Win32.ActiveCfg = Release|Win32
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.PGUpdate|x64.ActiveCfg = Release|Win32
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Release|ARM.ActiveCfg = Release|ARM
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Release|ARM.Build.0 = Release|ARM
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Release|Win32.ActiveCfg = Release|Win32
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Release|Win32.Build.0 = Release|Win32
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Release|x64.ActiveCfg = Release|x64
Expand Down
8 changes: 8 additions & 0 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,10 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
return tstate->interp->eval_frame(f, throwflag);
}

#ifdef _M_ARM
#pragma optimize ("", off)
#endif // _M_ARM

PyObject* _Py_HOT_FUNCTION
_PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
{
Expand Down Expand Up @@ -3500,6 +3504,10 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
return _Py_CheckFunctionResult(NULL, retval, "PyEval_EvalFrameEx");
}

#ifdef _M_ARM
#pragma optimize ("", on)
#endif // _M_ARM

static void
format_missing(const char *kind, PyCodeObject *co, PyObject *names)
{
Expand Down
43 changes: 15 additions & 28 deletions Tools/winiot/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,29 @@
setlocal
set D=%~dp0
set PCBUILD=%D%..\..\PCbuild\
set PYTHON_EXE=%PCBUILD%..\externals\pythonx86\tools\python.exe
if "%Py_OutDir%"=="" set Py_OutDir=%PCBUILD%

set BUILDX86=
set BUILDX64=
set BUILDARM=
set SYNCX86=
set SYNCX64=
set SYNCARM=
set REBUILD=
set OUTPUT=
set PACKAGES=
set DEBUG=
set DEBUG_SUFFIX=
set TEST=
set _SUFFIX=

:CheckOpts
if "%~1" EQU "-h" goto Help
if "%~1" EQU "-x86" (set BUILDX86=1 && set SYNCX86=1) && shift && goto CheckOpts
if "%~1" EQU "-x64" (set BUILDX64=1 && set SYNCX64=1) && shift && goto CheckOpts
if "%~1" EQU "-arm" (set BUILDARM=1 && set SYNCARM=1) && shift && goto CheckOpts
if "%~1" EQU "-x86" (set BUILDX86=1) && shift && goto CheckOpts
if "%~1" EQU "-x64" (set BUILDX64=1) && shift && goto CheckOpts
if "%~1" EQU "-arm" (set BUILDARM=1) && shift && goto CheckOpts
if "%~1" EQU "-t" (set TEST=-t) && shift && goto CheckOpts
if "%~1" EQU "-r" (set REBUILD=-r) && shift && goto CheckOpts
if "%~1" EQU "-d" (set DEBUG=-d && set _SUFFIX=_d) && shift && goto CheckOpts
if "%~1" EQU "-o" (set OUTPUT="/p:OutputPath=%~2") && shift && shift && goto CheckOpts
if "%~1" EQU "--out" (set OUTPUT="/p:OutputPath=%~2") && shift && shift && goto CheckOpts
if "%~1" EQU "-p" (set PACKAGES=%PACKAGES% %~2) && shift && shift && goto CheckOpts
if "%~1" NEQ "" echo Unknown parameter "%~1" && exit

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

:: need x64 python.exe to run sync_win_iot.pl when only building for ARM
if defined BUILDARM (
if not exist "%PCBUILD%amd64\python.exe" ( set BUILDX64=1 )
)

call "%PCBUILD%find_msbuild.bat" %MSBUILD%
if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2)

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

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

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

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

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

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

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

exit /B 0
Expand All @@ -78,7 +65,7 @@ echo.
echo -x86 Build and sync x86 files
echo -x64 Build and sync x64 files
echo -arm Build and sync arm files (will build X64 to execute tools)
echo -t Include test files
echo -d Build Debug configuration
echo -r Rebuild rather than incremental build
echo --out [DIR] Override output directory
echo -h Show usage
37 changes: 0 additions & 37 deletions Tools/winiot/sync_win_iot.proj

This file was deleted.

Loading

0 comments on commit dbb9be6

Please sign in to comment.