Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET 8.0 #1791

Merged
merged 10 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ 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 @@ -81,8 +84,10 @@ 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]
os: [windows-latest, ubuntu-latest, macos-latest-large]

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 7.0
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'
dotnet-version: '8.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 (net7.0)
run: ./make.ps1 -frameworks net7.0 test-all
- name: Test (net8.0)
run: ./make.ps1 -frameworks net8.0 test-all
shell: pwsh
9 changes: 0 additions & 9 deletions Build/net7.0-windows.props

This file was deleted.

9 changes: 9 additions & 0 deletions Build/net8.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)' == 'net8.0-windows' ">$(BaseIntermediateOutputPath)$(Configuration)\net8.0</IntermediateOutputPath>
<OutputPath Condition=" '$(TargetFramework)' == 'net8.0-windows' ">$(BaseOutputPath)\net8.0</OutputPath>
</PropertyGroup>

<Import Project="net8.0.props" />
</Project>
3 changes: 0 additions & 3 deletions Build/net7.0.props → Build/net8.0.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@
<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 @@ -32,7 +30,6 @@
<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: 9 additions & 0 deletions Build/net9.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)' == 'net9.0-windows' ">$(BaseIntermediateOutputPath)$(Configuration)\net9.0</IntermediateOutputPath>
<OutputPath Condition=" '$(TargetFramework)' == 'net9.0-windows' ">$(BaseOutputPath)\net9.0</OutputPath>
</PropertyGroup>

<Import Project="net9.0.props" />
</Project>
38 changes: 38 additions & 0 deletions Build/net9.0.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<IsFullFramework>false</IsFullFramework>
</PropertyGroup>

<PropertyGroup>
<Features>$(Features);FEATURE_APARTMENTSTATE</Features>
<Features>$(Features);FEATURE_ASSEMBLY_GETFORWARDEDTYPES</Features>
<Features>$(Features);FEATURE_ASSEMBLY_RESOLVE</Features>
<Features>$(Features);FEATURE_ASSEMBLYBUILDER_DEFINEDYNAMICASSEMBLY</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_CRYPTO</Features>
<Features>$(Features);FEATURE_FULL_NET</Features>
<Features>$(Features);FEATURE_LCG</Features>
<Features>$(Features);FEATURE_LOADWITHPARTIALNAME</Features>
<Features>$(Features);FEATURE_METADATA_READER</Features>
<Features>$(Features);FEATURE_MMAP</Features>
<Features>$(Features);FEATURE_NATIVE</Features>
<Features>$(Features);FEATURE_OSPLATFORMATTRIBUTE</Features>
<Features>$(Features);FEATURE_PIPES</Features>
<Features>$(Features);FEATURE_PROCESS</Features>
<Features>$(Features);FEATURE_REFEMIT</Features>
<Features>$(Features);FEATURE_REGISTRY</Features>
<Features>$(Features);FEATURE_RUNTIMEINFORMATION</Features>
<Features>$(Features);FEATURE_SECURITY_RULES</Features>
<Features>$(Features);FEATURE_STACK_TRACE</Features>
<Features>$(Features);FEATURE_SYNC_SOCKETS</Features>
<Features>$(Features);FEATURE_THREAD</Features>
<Features>$(Features);FEATURE_XMLDOC</Features>
</PropertyGroup>
</Project>
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 7.0 SDK for build
displayName: Install .NET 8.0 SDK for build
inputs:
packageType: 'sdk'
version: '7.0.x'
version: '8.0.x'

# Set Mono version on macOS
- ${{ if eq(parameters.os, 'macOS') }}:
Expand Down
10 changes: 6 additions & 4 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 16
VisualStudioVersion = 16.0.28917.181
# Visual Studio Version 17
VisualStudioVersion = 17.9.34714.143
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,8 +37,10 @@ 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\net7.0-windows.props = Build\net7.0-windows.props
Build\net7.0.props = Build\net7.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\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,11 +2,12 @@

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

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.3.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.10.0" 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.0-rc.1" DefaultTargets="Build">
<Project Sdk="WixToolset.Sdk/4.0.5" 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.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" />
<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" />
</ItemGroup>
<ItemGroup>
<HarvestDirectory Include="$(BindInputPaths)\Lib">
Expand Down
10 changes: 7 additions & 3 deletions Package/nuget/IronPython.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,16 @@ 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\**\*;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="**\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="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)\net7.0*\**\*;$(StageDir)\net8.0*\**\*" />
<ZipFiles Include="$(StageDir)\**\*.*" Exclude="$(StageDir)\README.md;$(StageDir)\**\*.pdb;$(StageDir)\netstandard2.0\**\*;$(StageDir)\netcoreapp3.1\**\*;$(StageDir)\net9.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
+7 −1 .editorconfig
+16 −1 .github/workflows/main.yml
+1 −1 Build.proj
+37 −0 Build/net8.0.props
+37 −0 Build/net9.0.props
+26 −29 Build/steps.yml
+2 −0 Dlr.sln
+6 −3 Package/nuget/DynamicLanguageRuntime.nuspec
+1 −1 Src/Microsoft.Dynamic/Actions/Calls/ArgumentBinding.cs
+1 −1 Src/Microsoft.Dynamic/Actions/MemberTracker.cs
+10 −12 Src/Microsoft.Dynamic/Actions/NamespaceTracker.cs
+4 −0 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
+31 −0 Src/Microsoft.Dynamic/SerializationStubs.cs
+24 −0 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
+8 −1 Src/Microsoft.Scripting/Microsoft.Scripting.csproj
+1 −1 Src/Microsoft.Scripting/Runtime/LanguageContext.cs
+1 −1 Src/Microsoft.Scripting/Runtime/ScopeExtension.cs
+0 −32 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;net7.0</TargetFrameworks>
<TargetFrameworks>net462;netstandard2.0;net6.0;net8.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>
[PythonHidden]
[PythonType, 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", StringComparison.Ordinal) || line.EndsWith("\r", StringComparison.Ordinal)) && _state == State.InField) {
if ((line.EndsWith('\n') || line.EndsWith('\r')) && _state == State.InField) {
continue;
}
}
Expand Down
2 changes: 2 additions & 0 deletions Src/IronPython.Modules/_ctypes/_ctypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -546,10 +546,12 @@ 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, s.Length - dotPos - 1));
return GetOneAttr(context, nextParam, s.Substring(dotPos + 1));
}
return PythonOps.GetBoundAttr(context, param, s);
}
Expand Down
16 changes: 6 additions & 10 deletions Src/IronPython.Modules/_socket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2215,10 +2215,6 @@ 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 @@ -2235,9 +2231,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 PtrToStructure<servent64>(result).s_name;
return Marshal.PtrToStructure<servent64>(result).s_name;
else
return PtrToStructure<servent>(result).s_name;
return Marshal.PtrToStructure<servent>(result).s_name;
}

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

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

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

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

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

ushort port = PtrToStructure<servent>(result).s_port;
ushort port = Marshal.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() {
Stream s = ToStream();
MemoryStream 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() {
Stream s = ToStream();
MemoryStream 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 == null) {
if (suffix.IsEmpty) {
var pad = new byte[lenDec - res.Length];
res.Write(pad, 0, pad.Length);
} else {
Expand Down
Loading
Loading