Skip to content

Commit

Permalink
Revert ".NET 8.0 (IronLanguages#1791)"
Browse files Browse the repository at this point in the history
This reverts commit 95e3048.
  • Loading branch information
dosymep authored Jul 2, 2024
1 parent 95e3048 commit 94f49d1
Show file tree
Hide file tree
Showing 72 changed files with 401 additions and 607 deletions.
5 changes: 0 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ dotnet_diagnostic.CA1305.severity = none # CA1305: Specify IFormatProvide
dotnet_diagnostic.CA1307.severity = suggestion # CA1307: Specify StringComparison for clarity
dotnet_diagnostic.CA1309.severity = suggestion # CA1309: Use ordinal string comparison
dotnet_diagnostic.CA1310.severity = warning # CA1310: Specify StringComparison for correctness
dotnet_diagnostic.CA1510.severity = none # CA1510: Use ArgumentNullException throw helper
dotnet_diagnostic.CA1512.severity = none # CA1512: Use ArgumentOutOfRangeException throw helper
dotnet_diagnostic.CA1513.severity = none # CA1513: Use ObjectDisposedException throw helper
dotnet_diagnostic.CA1707.severity = none # CA1707: Identifiers should not contain underscores
dotnet_diagnostic.CA1708.severity = none # CA1708: Identifiers should differ by more than case
dotnet_diagnostic.CA1710.severity = none # CA1710: Identifiers should have correct suffix
Expand All @@ -84,10 +81,8 @@ dotnet_diagnostic.CA1845.severity = none # CA1845: Use span-based 'string
dotnet_diagnostic.CA1846.severity = none # CA1846: Prefer 'AsSpan' over 'Substring'
dotnet_diagnostic.CA1847.severity = none # CA1847: Use char literal for a single character lookup
dotnet_diagnostic.CA1852.severity = suggestion # CA1852: Seal internal types
dotnet_diagnostic.CA1854.severity = suggestion # CA1854: Prefer the 'IDictionary.TryGetValue(TKey, out TValue)' method
dotnet_diagnostic.CA1859.severity = suggestion # CA1859: Use concrete types when possible for improved performance
dotnet_diagnostic.CA1861.severity = suggestion # CA1861: Avoid constant arrays as arguments
dotnet_diagnostic.CA1863.severity = none # CA1863: Use 'CompositeFormat'
dotnet_diagnostic.CA2101.severity = suggestion # CA2101: Specify marshaling for P/Invoke string arguments
dotnet_diagnostic.CA2201.severity = none # CA2201: Do not raise reserved exception types
dotnet_diagnostic.CA2208.severity = suggestion # CA2208: Instantiate argument exceptions correctly
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest-large]
os: [windows-latest, ubuntu-latest, macos-latest]

steps:
- name: Install tools
Expand All @@ -27,10 +27,10 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
- name: Setup .NET 8.0
- name: Setup .NET 7.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0.x'
dotnet-version: '7.0.x'
- name: Version Information
run: |
dotnet --info
Expand All @@ -54,6 +54,6 @@ jobs:
- name: Test (net6.0)
run: ./make.ps1 -frameworks net6.0 test-all
shell: pwsh
- name: Test (net8.0)
run: ./make.ps1 -frameworks net8.0 test-all
- name: Test (net7.0)
run: ./make.ps1 -frameworks net7.0 test-all
shell: pwsh
9 changes: 9 additions & 0 deletions Build/net7.0-windows.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project>
<PropertyGroup>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<IntermediateOutputPath Condition=" '$(TargetFramework)' == 'net7.0-windows' ">$(BaseIntermediateOutputPath)$(Configuration)\net7.0</IntermediateOutputPath>
<OutputPath Condition=" '$(TargetFramework)' == 'net7.0-windows' ">$(BaseOutputPath)\net7.0</OutputPath>
</PropertyGroup>

<Import Project="net7.0.props" />
</Project>
3 changes: 3 additions & 0 deletions Build/net8.0.props → Build/net7.0.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
<Features>$(Features);FEATURE_ASSEMBLY_GETFORWARDEDTYPES</Features>
<Features>$(Features);FEATURE_ASSEMBLY_RESOLVE</Features>
<Features>$(Features);FEATURE_ASSEMBLYBUILDER_DEFINEDYNAMICASSEMBLY</Features>
<Features>$(Features);FEATURE_BASIC_CONSOLE</Features>
<Features>$(Features);FEATURE_CODEDOM</Features>
<Features>$(Features);FEATURE_COM</Features>
<Features>$(Features);FEATURE_CONFIGURATION</Features>
<Features>$(Features);FEATURE_CTYPES</Features>
<Features>$(Features);FEATURE_CUSTOM_TYPE_DESCRIPTOR</Features>
<Features>$(Features);FEATURE_EXCEPTION_STATE</Features>
<Features>$(Features);FEATURE_FILESYSTEM</Features>
<Features>$(Features);FEATURE_FULL_CONSOLE</Features>
<Features>$(Features);FEATURE_FULL_CRYPTO</Features>
<Features>$(Features);FEATURE_FULL_NET</Features>
<Features>$(Features);FEATURE_LCG</Features>
Expand All @@ -30,6 +32,7 @@
<Features>$(Features);FEATURE_REGISTRY</Features>
<Features>$(Features);FEATURE_RUNTIMEINFORMATION</Features>
<Features>$(Features);FEATURE_SECURITY_RULES</Features>
<Features>$(Features);FEATURE_SERIALIZATION</Features>
<Features>$(Features);FEATURE_STACK_TRACE</Features>
<Features>$(Features);FEATURE_SYNC_SOCKETS</Features>
<Features>$(Features);FEATURE_THREAD</Features>
Expand Down
9 changes: 0 additions & 9 deletions Build/net8.0-windows.props

This file was deleted.

9 changes: 0 additions & 9 deletions Build/net9.0-windows.props

This file was deleted.

38 changes: 0 additions & 38 deletions Build/net9.0.props

This file was deleted.

4 changes: 2 additions & 2 deletions Build/steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ steps:
version: '6.0.x'

- task: UseDotNet@2
displayName: Install .NET 8.0 SDK for build
displayName: Install .NET 7.0 SDK for build
inputs:
packageType: 'sdk'
version: '8.0.x'
version: '7.0.x'

# Set Mono version on macOS
- ${{ if eq(parameters.os, 'macOS') }}:
Expand Down
10 changes: 4 additions & 6 deletions IronPython.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34714.143
# Visual Studio Version 16
VisualStudioVersion = 16.0.28917.181
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IronPython", "Src\IronPython\IronPython.csproj", "{95289EA9-5778-489D-AB48-F81F2CE2DA32}"
EndProject
Expand Down Expand Up @@ -37,10 +37,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{17737ACB
Build\net462.props = Build\net462.props
Build\net6.0-windows.props = Build\net6.0-windows.props
Build\net6.0.props = Build\net6.0.props
Build\net8.0-windows.props = Build\net8.0-windows.props
Build\net8.0.props = Build\net8.0.props
Build\net9.0-windows.props = Build\net9.0-windows.props
Build\net9.0.props = Build\net9.0.props
Build\net7.0-windows.props = Build\net7.0-windows.props
Build\net7.0.props = Build\net7.0.props
Build\netcoreapp3.1.props = Build\netcoreapp3.1.props
Build\netstandard2.0.props = Build\netstandard2.0.props
Build\steps.yml = Build\steps.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.10.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.3.1" PrivateAssets="all" />
</ItemGroup>

</Project>
10 changes: 5 additions & 5 deletions Package/msi/IronPython.Installer.wixproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="WixToolset.Sdk/4.0.5" DefaultTargets="Build">
<Project Sdk="WixToolset.Sdk/4.0.0-rc.1" DefaultTargets="Build">
<PropertyGroup>
<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
<ProductVersion>3.4</ProductVersion>
Expand Down Expand Up @@ -44,10 +44,10 @@
<Content Include="Version.wxi" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="WixToolset.UI.wixext" Version="4.0.5" />
<PackageReference Include="WixToolset.NetFx.wixext" Version="4.0.5" />
<PackageReference Include="WixToolset.Util.wixext" Version="4.0.5" />
<PackageReference Include="WixToolset.Heat" Version="4.0.5" />
<PackageReference Include="WixToolset.UI.wixext" Version="4.0.0-rc.1" />
<PackageReference Include="WixToolset.NetFx.wixext" Version="4.0.0-rc.1" />
<PackageReference Include="WixToolset.Util.wixext" Version="4.0.0-rc.1" />
<PackageReference Include="WixToolset.Heat" Version="4.0.0-rc.1" />
</ItemGroup>
<ItemGroup>
<HarvestDirectory Include="$(BindInputPaths)\Lib">
Expand Down
10 changes: 3 additions & 7 deletions Package/nuget/IronPython.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,12 @@ This package contains the IronPython interpreter engine.</description>
<dependency id="DynamicLanguageRuntime" version="1.3.4" />
<dependency id="Mono.Unix" version="7.1.0-final.1.21458.1" />
</group>
<group targetFramework="net8.0">
<dependency id="DynamicLanguageRuntime" version="1.3.4" />
<dependency id="Mono.Unix" version="7.1.0-final.1.21458.1" />
</group>
</dependencies>
</metadata>
<files>
<file src="**\IronPython*.dll" target="lib" exclude="**\IronPythonTest.dll;**\DLLs\*.dll;netcoreapp3.1\**\*;net9.0*\**\*" />
<file src="**\IronPython*.pdb" target="lib" exclude="**\IronPythonTest.pdb;**\DLLs\*.pdb;netcoreapp3.1\**\*;net9.0*\**\*" />
<file src="**\IronPython*.xml" target="lib" exclude="**\IronPythonTest.xml;**\DLLs\*.xml;netcoreapp3.1\**\*;net9.0*\**\*" />
<file src="**\IronPython*.dll" target="lib" exclude="**\IronPythonTest.dll;**\DLLs\*.dll;netcoreapp3.1\**\*;net7.0*\**\*;net8.0*\**\*" />
<file src="**\IronPython*.pdb" target="lib" exclude="**\IronPythonTest.pdb;**\DLLs\*.pdb;netcoreapp3.1\**\*;net7.0*\**\*;net8.0*\**\*" />
<file src="**\IronPython*.xml" target="lib" exclude="**\IronPythonTest.xml;**\DLLs\*.xml;netcoreapp3.1\**\*;net7.0*\**\*;net8.0*\**\*" />
<file src="LICENSE" />
<file src="..\..\..\nuget\README.md" target="" />
<file src="..\..\..\..\Documentation\logo.png" target="" />
Expand Down
2 changes: 1 addition & 1 deletion Package/zip/Zip.Packaging.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<MakeDir Directories="$(PackageDir)" Condition="!Exists('$(PackageDir)')"/>

<ItemGroup>
<ZipFiles Include="$(StageDir)\**\*.*" Exclude="$(StageDir)\README.md;$(StageDir)\**\*.pdb;$(StageDir)\netstandard2.0\**\*;$(StageDir)\netcoreapp3.1\**\*;$(StageDir)\net9.0*\**\*" />
<ZipFiles Include="$(StageDir)\**\*.*" Exclude="$(StageDir)\README.md;$(StageDir)\**\*.pdb;$(StageDir)\netstandard2.0\**\*;$(StageDir)\netcoreapp3.1\**\*;$(StageDir)\net7.0*\**\*;$(StageDir)\net8.0*\**\*" />
<ZipFiles Include="README.md" Link="$(MSBuildThisFileDirectory)README.md" />
<ZipFiles Include="scripts/Enter-IronPythonEnvironment.ps1" Link="$(RootDir)Src\Scripts\Enter-IronPythonEnvironment.ps1" />
<ZipFiles Include="scripts/Install-IronPython.ps1" Link="$(RootDir)Src\Scripts\Install-IronPython.ps1" />
Expand Down
2 changes: 1 addition & 1 deletion Src/DLR
Submodule DLR updated 40 files
+1 −7 .editorconfig
+1 −16 .github/workflows/main.yml
+1 −1 Build.proj
+0 −37 Build/net8.0.props
+0 −37 Build/net9.0.props
+29 −26 Build/steps.yml
+0 −2 Dlr.sln
+3 −6 Package/nuget/DynamicLanguageRuntime.nuspec
+1 −1 Src/Microsoft.Dynamic/Actions/Calls/ArgumentBinding.cs
+1 −1 Src/Microsoft.Dynamic/Actions/MemberTracker.cs
+12 −10 Src/Microsoft.Dynamic/Actions/NamespaceTracker.cs
+0 −4 Src/Microsoft.Dynamic/ComInterop/ComInterop.cs
+1 −1 Src/Microsoft.Dynamic/ComInterop/ComParamDesc.cs
+4 −4 Src/Microsoft.Dynamic/ComInterop/ComRuntimeHelpers.cs
+1 −1 Src/Microsoft.Dynamic/ComInterop/ComTypeEnumDesc.cs
+2 −2 Src/Microsoft.Dynamic/ComInterop/ExcepInfo.cs
+1 −1 Src/Microsoft.Dynamic/ComInterop/IDispatchComObject.cs
+2 −2 Src/Microsoft.Dynamic/ComInterop/Variant.cs
+1 −1 Src/Microsoft.Dynamic/Debugging/ThreadLocal.cs
+3 −3 Src/Microsoft.Dynamic/Hosting/Shell/ConsoleHostOptionsParser.cs
+1 −1 Src/Microsoft.Dynamic/Interpreter/LightCompiler.cs
+1 −1 Src/Microsoft.Dynamic/Microsoft.Dynamic.csproj
+1 −1 Src/Microsoft.Dynamic/Runtime/SavableScriptCode.cs
+0 −31 Src/Microsoft.Dynamic/SerializationStubs.cs
+0 −24 Src/Microsoft.Dynamic/StringExtensions.cs
+2 −2 Src/Microsoft.Dynamic/Utils/CollectionExtensions.cs
+1 −1 Src/Microsoft.Dynamic/Utils/ReflectionUtils.cs
+1 −1 Src/Microsoft.Dynamic/Utils/ThreadLocal.cs
+2 −2 Src/Microsoft.Dynamic/Utils/WeakDictionary.cs
+1 −8 Src/Microsoft.Scripting/Microsoft.Scripting.csproj
+1 −1 Src/Microsoft.Scripting/Runtime/LanguageContext.cs
+1 −1 Src/Microsoft.Scripting/Runtime/ScopeExtension.cs
+32 −0 Src/Microsoft.Scripting/Stubs.cs
+2 −2 Src/Microsoft.Scripting/Utils/CollectionExtensions.cs
+1 −1 Tests/Metadata/Metadata.csproj
+1 −1 Tests/Metadata/TypeNestings.cs
+1 −1 Tests/Microsoft.Dynamic.Test/InterpreterTest.cs
+1 −1 Tests/Microsoft.Dynamic.Test/Microsoft.Dynamic.Test.csproj
+1 −1 Tests/Microsoft.Scripting.Test/Microsoft.Scripting.Test.csproj
+1 −1 make.ps1
2 changes: 1 addition & 1 deletion Src/IronPython.Modules/IronPython.Modules.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0;net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net462;netstandard2.0;net6.0;net7.0</TargetFrameworks>
<BaseAddress>885063680</BaseAddress>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand Down
2 changes: 1 addition & 1 deletion Src/IronPython.Modules/_codecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ private static Tuple<Bytes, int> DoEncode(CodeContext context, string encodingNa
/// <summary>
/// Optimized encoding mapping that can be consumed by charmap_encode/EncodingMapEncoding.
/// </summary>
[PythonType, PythonHidden]
[PythonHidden]
public class EncodingMap {
private readonly string _smap;
[DisallowNull] private Dictionary<byte, int>? _dmap;
Expand Down
2 changes: 1 addition & 1 deletion Src/IronPython.Modules/_csv.cs
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ public bool MoveNext() {
// If we ended on an escaped newline, then we want to continue onto
// the nextline without processing the end of this one, as the newline
// is in the middle of the field.
if ((line.EndsWith('\n') || line.EndsWith('\r')) && _state == State.InField) {
if ((line.EndsWith("\n", StringComparison.Ordinal) || line.EndsWith("\r", StringComparison.Ordinal)) && _state == State.InField) {
continue;
}
}
Expand Down
2 changes: 0 additions & 2 deletions Src/IronPython.Modules/_ctypes/_ctypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -546,12 +546,10 @@ private static ModuleBuilder DynamicModule {
lock (_nativeTypes) {
if (!_nativeTypes.TryGetValue(size, out Type res)) {
int sizeRemaining = size;
#pragma warning disable SYSLIB0050 // Type or member is obsolete
TypeBuilder tb = DynamicModule.DefineType("interop_type_size_" + size,
TypeAttributes.Public | TypeAttributes.SequentialLayout | TypeAttributes.Sealed | TypeAttributes.Serializable,
typeof(ValueType),
size);
#pragma warning restore SYSLIB0050 // Type or member is obsolete

while (sizeRemaining > 8) {
tb.DefineField("field" + sizeRemaining, typeof(long), FieldAttributes.Private);
Expand Down
2 changes: 1 addition & 1 deletion Src/IronPython.Modules/_operator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private static object GetOneAttr(CodeContext context, object param, object val)
int dotPos = s.IndexOf('.');
if (dotPos >= 0) {
object nextParam = GetOneAttr(context, param, s.Substring(0, dotPos));
return GetOneAttr(context, nextParam, s.Substring(dotPos + 1));
return GetOneAttr(context, nextParam, s.Substring(dotPos + 1, s.Length - dotPos - 1));
}
return PythonOps.GetBoundAttr(context, param, s);
}
Expand Down
16 changes: 10 additions & 6 deletions Src/IronPython.Modules/_socket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2215,6 +2215,10 @@ internal struct WSAData {
[DllImport("ws2_32.dll", SetLastError = true)]
private static extern Int32 WSACleanup();

private static T PtrToStructure<T>(IntPtr result) {
return (T)Marshal.PtrToStructure(result, typeof(T))!;
}

public static string GetServiceByPort(ushort port, string? protocol) {
if (Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX)
return GetServiceByPortNonWindows(port, protocol);
Expand All @@ -2231,9 +2235,9 @@ static string GetServiceByPortWindows(ushort port, string? protocol) {
throw new SocketUtilException(string.Format("Could not resolve service for port {0}", port));

if (Environment.Is64BitProcess)
return Marshal.PtrToStructure<servent64>(result).s_name;
return PtrToStructure<servent64>(result).s_name;
else
return Marshal.PtrToStructure<servent>(result).s_name;
return PtrToStructure<servent>(result).s_name;
}

static string GetServiceByPortNonWindows(ushort port, string? protocol) {
Expand All @@ -2244,7 +2248,7 @@ static string GetServiceByPortNonWindows(ushort port, string? protocol) {
string.Format("Could not resolve service for port {0}", port));
}

return Marshal.PtrToStructure<servent>(result).s_name;
return PtrToStructure<servent>(result).s_name;
}
}

Expand All @@ -2263,9 +2267,9 @@ static ushort GetServiceByNameWindows(string service, string? protocol) {

ushort port;
if (Environment.Is64BitProcess)
port = Marshal.PtrToStructure<servent64>(result).s_port;
port = PtrToStructure<servent64>(result).s_port;
else
port = Marshal.PtrToStructure<servent>(result).s_port;
port = PtrToStructure<servent>(result).s_port;

var hostport = IPAddress.NetworkToHostOrder(unchecked((short)port));
return unchecked((ushort)hostport);
Expand All @@ -2278,7 +2282,7 @@ static ushort GetServiceByNameNonWindows(string service, string? protocol) {
string.Format("Could not resolve port for service {0}", service));
}

ushort port = Marshal.PtrToStructure<servent>(result).s_port;
ushort port = PtrToStructure<servent>(result).s_port;
var hostport = IPAddress.NetworkToHostOrder(unchecked((short)port));
return unchecked((ushort)hostport);
}
Expand Down
4 changes: 2 additions & 2 deletions Src/IronPython.Modules/array.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public PythonTuple buffer_info() {
}

public void byteswap() {
MemoryStream s = ToStream();
Stream s = ToStream();
byte[] bytes = new byte[s.Length];
s.Read(bytes, 0, bytes.Length);

Expand Down Expand Up @@ -618,7 +618,7 @@ public PythonList tolist() {
}

public Bytes tobytes() {
MemoryStream s = ToStream();
Stream s = ToStream();
byte[] bytes = new byte[s.Length];
s.Read(bytes, 0, (int)s.Length);
return Bytes.Make(bytes);
Expand Down
2 changes: 1 addition & 1 deletion Src/IronPython.Modules/binascii.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static Bytes a2b_uu_impl(CodeContext/*!*/ context, ReadOnlySpan<byte> data) {
}

using MemoryStream res = DecodeWorker(context, data, true, UuDecFunc);
if (suffix.IsEmpty) {
if (suffix == null) {
var pad = new byte[lenDec - res.Length];
res.Write(pad, 0, pad.Length);
} else {
Expand Down
Loading

0 comments on commit 94f49d1

Please sign in to comment.