Staging
v0.5.1
v0.5.1
https://github.com/python/cpython
Revision 75345c552d0889f4f63039d6063f371846c8f41f authored by Nick Coghlan on 12 March 2017, 11:34:22 UTC, committed by Ned Deily on 21 March 2017, 05:55:11 UTC
Directory and zipfile execution previously added the parent directory of the directory or zipfile as sys.path[0] and then subsequently overwrote it with the directory or zipfile itself. This caused problems in isolated mode, as it overwrote the "stdlib as a zip archive" entry in sys.path, as the parent directory was never added. The attempted fix to that issue in bpo-29319 created the opposite problem in *non*-isolated mode, by potentially leaving the parent directory on sys.path instead of overwriting it. This change fixes the root cause of the problem by removing the whole "add-and-overwrite" dance for sys.path[0], and instead simply never adds the parent directory to sys.path in the first place. (cherry picked from commit d2977a3ae2cc6802921b1e3b6e9d13fcfbda872d) (cherry picked from commit c60948464fb0ec116ea227f6bce8a4bb8fb75257)
1 parent 07e6cbd
Tip revision: 75345c552d0889f4f63039d6063f371846c8f41f authored by Nick Coghlan on 12 March 2017, 11:34:22 UTC
[3.6] bpo-29723: Consistently configure sys.path[0] (#636)
[3.6] bpo-29723: Consistently configure sys.path[0] (#636)
Tip revision: 75345c5
python3dll.vcxproj
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="PGInstrument|Win32">
<Configuration>PGInstrument</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="PGInstrument|x64">
<Configuration>PGInstrument</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="PGUpdate|Win32">
<Configuration>PGUpdate</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="PGUpdate|x64">
<Configuration>PGUpdate</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{885D4898-D08D-4091-9C40-C700CFE3FC5A}</ProjectGuid>
<RootNamespace>python3dll</RootNamespace>
<Keyword>Win32Proj</Keyword>
<TargetName>python3</TargetName>
<SupportPGO>false</SupportPGO>
</PropertyGroup>
<Import Project="python.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="pyproject.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<_Machine>X86</_Machine>
<_Machine Condition="$(Platform) == 'x64'">X64</_Machine>
<ExtensionsToDeleteOnClean>$(ExtensionsToDeleteOnClean);$(IntDir)python3_d.def;$(IntDir)python3stub.def</ExtensionsToDeleteOnClean>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Link>
<AdditionalDependencies>$(OutDir)$(TargetName)stub.lib</AdditionalDependencies>
<ModuleDefinitionFile Condition="$(Configuration) != 'Debug'">$(PySourcePath)PC\python3.def</ModuleDefinitionFile>
<ModuleDefinitionFile Condition="$(Configuration) == 'Debug'">$(IntDir)python3_d.def</ModuleDefinitionFile>
<EntryPointSymbol>DllMain</EntryPointSymbol>
</Link>
<PreLinkEvent>
<Command>lib /nologo /def:"$(IntDir)python3stub.def" /out:"$(OutDir)$(TargetName)stub.lib" /MACHINE:$(_Machine)</Command>
<Message>Rebuilding $(TargetName)stub.lib</Message>
<Outputs>$(OutDir)$(TargetName)stub.lib</Outputs>
</PreLinkEvent>
</ItemDefinitionGroup>
<ItemGroup>
<None Include="..\PC\python3.def" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\PC\python3dll.c" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\PC\python_nt.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<Target Name="BuildPython3_dDef" BeforeTargets="BuildStubDef" Inputs="..\PC\python3.def" Outputs="$(IntDir)python3_d.def" Condition="$(Configuration) == 'Debug'">
<ItemGroup>
<_DefLines Remove="@(_DefLines)" />
<_Lines Remove="@(_Lines)" />
</ItemGroup>
<ReadLinesFromFile File="..\PC\python3.def">
<Output TaskParameter="Lines" ItemName="_DefLines" />
</ReadLinesFromFile>
<PropertyGroup>
<_Pattern1>(=python$(MajorVersionNumber)$(MinorVersionNumber))\.</_Pattern1>
<_Sub1>$1_d.</_Sub1>
<_Pattern2>"python3"</_Pattern2>
<_Sub2>"python3_d"</_Sub2>
</PropertyGroup>
<ItemGroup>
<_Lines Include="@(_DefLines)">
<New>$([System.Text.RegularExpressions.Regex]::Replace($([System.Text.RegularExpressions.Regex]::Replace(`%(Identity)`, `$(_Pattern1)`, `$(_Sub1)`)), `$(_Pattern2)`, `$(_Sub2)`))</New>
</_Lines>
</ItemGroup>
<MakeDir Directories="$(IntDir)" />
<WriteLinesToFile File="$(IntDir)python3_d.def" Lines="@(_Lines->'%(New)')" Overwrite="true" />
</Target>
<Target Name="BuildStubDef" BeforeTargets="PreLinkEvent" Inputs="..\PC\python3.def" Outputs="$(IntDir)python3stub.def">
<ItemGroup>
<_DefLines Remove="@(_DefLines)" />
<_Lines Remove="@(_Lines)" />
</ItemGroup>
<ReadLinesFromFile File="..\PC\python3.def">
<Output TaskParameter="Lines" ItemName="_DefLines" />
</ReadLinesFromFile>
<PropertyGroup>
<_Pattern>^[\w.]+=.+?\.([^ ]+).*$</_Pattern>
<_Sub>$1</_Sub>
</PropertyGroup>
<ItemGroup>
<_Lines Include="EXPORTS" />
<_Symbols Include="@(_DefLines)" Condition="$([System.Text.RegularExpressions.Regex]::IsMatch(`%(Identity)`, `$(_Pattern)`))">
<Symbol>$([System.Text.RegularExpressions.Regex]::Replace(`%(Identity)`, `$(_Pattern)`, `$(_Sub)`))</Symbol>
</_Symbols>
<_Lines Include="@(_Symbols->'%(Symbol)')" />
</ItemGroup>
<MakeDir Directories="$(IntDir)" />
<WriteLinesToFile File="$(IntDir)python3stub.def" Lines="@(_Lines)" Overwrite="true" />
</Target>
</Project>
Computing file changes ...