Skip to content

Commit 95e3048

Browse files
authored
* .NET 8.0 * Update WixToolset * Fix some test failures * Improve serialization of .NET primitive types * Build with .NET 9 SDK * Bump packages * Use contraint-based assert and switch back to .NET 8 for testing * Fix failing test * Don't add .NET 7 to CI * Get test passing on Mono
1 parent 82f498c commit 95e3048

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+607
-401
lines changed

.editorconfig

+5
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ dotnet_diagnostic.CA1305.severity = none # CA1305: Specify IFormatProvide
6060
dotnet_diagnostic.CA1307.severity = suggestion # CA1307: Specify StringComparison for clarity
6161
dotnet_diagnostic.CA1309.severity = suggestion # CA1309: Use ordinal string comparison
6262
dotnet_diagnostic.CA1310.severity = warning # CA1310: Specify StringComparison for correctness
63+
dotnet_diagnostic.CA1510.severity = none # CA1510: Use ArgumentNullException throw helper
64+
dotnet_diagnostic.CA1512.severity = none # CA1512: Use ArgumentOutOfRangeException throw helper
65+
dotnet_diagnostic.CA1513.severity = none # CA1513: Use ObjectDisposedException throw helper
6366
dotnet_diagnostic.CA1707.severity = none # CA1707: Identifiers should not contain underscores
6467
dotnet_diagnostic.CA1708.severity = none # CA1708: Identifiers should differ by more than case
6568
dotnet_diagnostic.CA1710.severity = none # CA1710: Identifiers should have correct suffix
@@ -81,8 +84,10 @@ dotnet_diagnostic.CA1845.severity = none # CA1845: Use span-based 'string
8184
dotnet_diagnostic.CA1846.severity = none # CA1846: Prefer 'AsSpan' over 'Substring'
8285
dotnet_diagnostic.CA1847.severity = none # CA1847: Use char literal for a single character lookup
8386
dotnet_diagnostic.CA1852.severity = suggestion # CA1852: Seal internal types
87+
dotnet_diagnostic.CA1854.severity = suggestion # CA1854: Prefer the 'IDictionary.TryGetValue(TKey, out TValue)' method
8488
dotnet_diagnostic.CA1859.severity = suggestion # CA1859: Use concrete types when possible for improved performance
8589
dotnet_diagnostic.CA1861.severity = suggestion # CA1861: Avoid constant arrays as arguments
90+
dotnet_diagnostic.CA1863.severity = none # CA1863: Use 'CompositeFormat'
8691
dotnet_diagnostic.CA2101.severity = suggestion # CA2101: Specify marshaling for P/Invoke string arguments
8792
dotnet_diagnostic.CA2201.severity = none # CA2201: Do not raise reserved exception types
8893
dotnet_diagnostic.CA2208.severity = suggestion # CA2208: Instantiate argument exceptions correctly

.github/workflows/main.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
os: [windows-latest, ubuntu-latest, macos-latest]
13+
os: [windows-latest, ubuntu-latest, macos-latest-large]
1414

1515
steps:
1616
- name: Install tools
@@ -27,10 +27,10 @@ jobs:
2727
uses: actions/setup-dotnet@v1
2828
with:
2929
dotnet-version: '6.0.x'
30-
- name: Setup .NET 7.0
30+
- name: Setup .NET 8.0
3131
uses: actions/setup-dotnet@v1
3232
with:
33-
dotnet-version: '7.0.x'
33+
dotnet-version: '8.0.x'
3434
- name: Version Information
3535
run: |
3636
dotnet --info
@@ -54,6 +54,6 @@ jobs:
5454
- name: Test (net6.0)
5555
run: ./make.ps1 -frameworks net6.0 test-all
5656
shell: pwsh
57-
- name: Test (net7.0)
58-
run: ./make.ps1 -frameworks net7.0 test-all
57+
- name: Test (net8.0)
58+
run: ./make.ps1 -frameworks net8.0 test-all
5959
shell: pwsh

Build/net7.0-windows.props

-9
This file was deleted.

Build/net8.0-windows.props

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Project>
2+
<PropertyGroup>
3+
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
4+
<IntermediateOutputPath Condition=" '$(TargetFramework)' == 'net8.0-windows' ">$(BaseIntermediateOutputPath)$(Configuration)\net8.0</IntermediateOutputPath>
5+
<OutputPath Condition=" '$(TargetFramework)' == 'net8.0-windows' ">$(BaseOutputPath)\net8.0</OutputPath>
6+
</PropertyGroup>
7+
8+
<Import Project="net8.0.props" />
9+
</Project>

Build/net7.0.props renamed to Build/net8.0.props

-3
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@
99
<Features>$(Features);FEATURE_ASSEMBLY_GETFORWARDEDTYPES</Features>
1010
<Features>$(Features);FEATURE_ASSEMBLY_RESOLVE</Features>
1111
<Features>$(Features);FEATURE_ASSEMBLYBUILDER_DEFINEDYNAMICASSEMBLY</Features>
12-
<Features>$(Features);FEATURE_BASIC_CONSOLE</Features>
1312
<Features>$(Features);FEATURE_CODEDOM</Features>
1413
<Features>$(Features);FEATURE_COM</Features>
1514
<Features>$(Features);FEATURE_CONFIGURATION</Features>
1615
<Features>$(Features);FEATURE_CTYPES</Features>
1716
<Features>$(Features);FEATURE_CUSTOM_TYPE_DESCRIPTOR</Features>
1817
<Features>$(Features);FEATURE_EXCEPTION_STATE</Features>
1918
<Features>$(Features);FEATURE_FILESYSTEM</Features>
20-
<Features>$(Features);FEATURE_FULL_CONSOLE</Features>
2119
<Features>$(Features);FEATURE_FULL_CRYPTO</Features>
2220
<Features>$(Features);FEATURE_FULL_NET</Features>
2321
<Features>$(Features);FEATURE_LCG</Features>
@@ -32,7 +30,6 @@
3230
<Features>$(Features);FEATURE_REGISTRY</Features>
3331
<Features>$(Features);FEATURE_RUNTIMEINFORMATION</Features>
3432
<Features>$(Features);FEATURE_SECURITY_RULES</Features>
35-
<Features>$(Features);FEATURE_SERIALIZATION</Features>
3633
<Features>$(Features);FEATURE_STACK_TRACE</Features>
3734
<Features>$(Features);FEATURE_SYNC_SOCKETS</Features>
3835
<Features>$(Features);FEATURE_THREAD</Features>

Build/net9.0-windows.props

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Project>
2+
<PropertyGroup>
3+
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
4+
<IntermediateOutputPath Condition=" '$(TargetFramework)' == 'net9.0-windows' ">$(BaseIntermediateOutputPath)$(Configuration)\net9.0</IntermediateOutputPath>
5+
<OutputPath Condition=" '$(TargetFramework)' == 'net9.0-windows' ">$(BaseOutputPath)\net9.0</OutputPath>
6+
</PropertyGroup>
7+
8+
<Import Project="net9.0.props" />
9+
</Project>

Build/net9.0.props

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<IsFullFramework>false</IsFullFramework>
5+
</PropertyGroup>
6+
7+
<PropertyGroup>
8+
<Features>$(Features);FEATURE_APARTMENTSTATE</Features>
9+
<Features>$(Features);FEATURE_ASSEMBLY_GETFORWARDEDTYPES</Features>
10+
<Features>$(Features);FEATURE_ASSEMBLY_RESOLVE</Features>
11+
<Features>$(Features);FEATURE_ASSEMBLYBUILDER_DEFINEDYNAMICASSEMBLY</Features>
12+
<Features>$(Features);FEATURE_CODEDOM</Features>
13+
<Features>$(Features);FEATURE_COM</Features>
14+
<Features>$(Features);FEATURE_CONFIGURATION</Features>
15+
<Features>$(Features);FEATURE_CTYPES</Features>
16+
<Features>$(Features);FEATURE_CUSTOM_TYPE_DESCRIPTOR</Features>
17+
<Features>$(Features);FEATURE_EXCEPTION_STATE</Features>
18+
<Features>$(Features);FEATURE_FILESYSTEM</Features>
19+
<Features>$(Features);FEATURE_FULL_CRYPTO</Features>
20+
<Features>$(Features);FEATURE_FULL_NET</Features>
21+
<Features>$(Features);FEATURE_LCG</Features>
22+
<Features>$(Features);FEATURE_LOADWITHPARTIALNAME</Features>
23+
<Features>$(Features);FEATURE_METADATA_READER</Features>
24+
<Features>$(Features);FEATURE_MMAP</Features>
25+
<Features>$(Features);FEATURE_NATIVE</Features>
26+
<Features>$(Features);FEATURE_OSPLATFORMATTRIBUTE</Features>
27+
<Features>$(Features);FEATURE_PIPES</Features>
28+
<Features>$(Features);FEATURE_PROCESS</Features>
29+
<Features>$(Features);FEATURE_REFEMIT</Features>
30+
<Features>$(Features);FEATURE_REGISTRY</Features>
31+
<Features>$(Features);FEATURE_RUNTIMEINFORMATION</Features>
32+
<Features>$(Features);FEATURE_SECURITY_RULES</Features>
33+
<Features>$(Features);FEATURE_STACK_TRACE</Features>
34+
<Features>$(Features);FEATURE_SYNC_SOCKETS</Features>
35+
<Features>$(Features);FEATURE_THREAD</Features>
36+
<Features>$(Features);FEATURE_XMLDOC</Features>
37+
</PropertyGroup>
38+
</Project>

Build/steps.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ steps:
3737
version: '6.0.x'
3838

3939
- task: UseDotNet@2
40-
displayName: Install .NET 7.0 SDK for build
40+
displayName: Install .NET 8.0 SDK for build
4141
inputs:
4242
packageType: 'sdk'
43-
version: '7.0.x'
43+
version: '8.0.x'
4444

4545
# Set Mono version on macOS
4646
- ${{ if eq(parameters.os, 'macOS') }}:

IronPython.sln

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.28917.181
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.9.34714.143
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IronPython", "Src\IronPython\IronPython.csproj", "{95289EA9-5778-489D-AB48-F81F2CE2DA32}"
77
EndProject
@@ -37,8 +37,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{17737ACB
3737
Build\net462.props = Build\net462.props
3838
Build\net6.0-windows.props = Build\net6.0-windows.props
3939
Build\net6.0.props = Build\net6.0.props
40-
Build\net7.0-windows.props = Build\net7.0-windows.props
41-
Build\net7.0.props = Build\net7.0.props
40+
Build\net8.0-windows.props = Build\net8.0-windows.props
41+
Build\net8.0.props = Build\net8.0.props
42+
Build\net9.0-windows.props = Build\net9.0-windows.props
43+
Build\net9.0.props = Build\net9.0.props
4244
Build\netcoreapp3.1.props = Build\netcoreapp3.1.props
4345
Build\netstandard2.0.props = Build\netstandard2.0.props
4446
Build\steps.yml = Build\steps.yml

IronPythonAnalyzer/IronPythonAnalyzer/IronPythonAnalyzer.csproj

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
5+
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
56
</PropertyGroup>
67

78
<ItemGroup>
8-
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3" PrivateAssets="all" />
9-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.3.1" PrivateAssets="all" />
9+
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" PrivateAssets="all" />
10+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.10.0" PrivateAssets="all" />
1011
</ItemGroup>
1112

1213
</Project>

Package/msi/IronPython.Installer.wixproj

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="WixToolset.Sdk/4.0.0-rc.1" DefaultTargets="Build">
1+
<Project Sdk="WixToolset.Sdk/4.0.5" DefaultTargets="Build">
22
<PropertyGroup>
33
<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
44
<ProductVersion>3.4</ProductVersion>
@@ -44,10 +44,10 @@
4444
<Content Include="Version.wxi" />
4545
</ItemGroup>
4646
<ItemGroup>
47-
<PackageReference Include="WixToolset.UI.wixext" Version="4.0.0-rc.1" />
48-
<PackageReference Include="WixToolset.NetFx.wixext" Version="4.0.0-rc.1" />
49-
<PackageReference Include="WixToolset.Util.wixext" Version="4.0.0-rc.1" />
50-
<PackageReference Include="WixToolset.Heat" Version="4.0.0-rc.1" />
47+
<PackageReference Include="WixToolset.UI.wixext" Version="4.0.5" />
48+
<PackageReference Include="WixToolset.NetFx.wixext" Version="4.0.5" />
49+
<PackageReference Include="WixToolset.Util.wixext" Version="4.0.5" />
50+
<PackageReference Include="WixToolset.Heat" Version="4.0.5" />
5151
</ItemGroup>
5252
<ItemGroup>
5353
<HarvestDirectory Include="$(BindInputPaths)\Lib">

Package/nuget/IronPython.nuspec

+7-3
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,16 @@ This package contains the IronPython interpreter engine.</description>
3333
<dependency id="DynamicLanguageRuntime" version="1.3.4" />
3434
<dependency id="Mono.Unix" version="7.1.0-final.1.21458.1" />
3535
</group>
36+
<group targetFramework="net8.0">
37+
<dependency id="DynamicLanguageRuntime" version="1.3.4" />
38+
<dependency id="Mono.Unix" version="7.1.0-final.1.21458.1" />
39+
</group>
3640
</dependencies>
3741
</metadata>
3842
<files>
39-
<file src="**\IronPython*.dll" target="lib" exclude="**\IronPythonTest.dll;**\DLLs\*.dll;netcoreapp3.1\**\*;net7.0*\**\*;net8.0*\**\*" />
40-
<file src="**\IronPython*.pdb" target="lib" exclude="**\IronPythonTest.pdb;**\DLLs\*.pdb;netcoreapp3.1\**\*;net7.0*\**\*;net8.0*\**\*" />
41-
<file src="**\IronPython*.xml" target="lib" exclude="**\IronPythonTest.xml;**\DLLs\*.xml;netcoreapp3.1\**\*;net7.0*\**\*;net8.0*\**\*" />
43+
<file src="**\IronPython*.dll" target="lib" exclude="**\IronPythonTest.dll;**\DLLs\*.dll;netcoreapp3.1\**\*;net9.0*\**\*" />
44+
<file src="**\IronPython*.pdb" target="lib" exclude="**\IronPythonTest.pdb;**\DLLs\*.pdb;netcoreapp3.1\**\*;net9.0*\**\*" />
45+
<file src="**\IronPython*.xml" target="lib" exclude="**\IronPythonTest.xml;**\DLLs\*.xml;netcoreapp3.1\**\*;net9.0*\**\*" />
4246
<file src="LICENSE" />
4347
<file src="..\..\..\nuget\README.md" target="" />
4448
<file src="..\..\..\..\Documentation\logo.png" target="" />

Package/zip/Zip.Packaging.targets

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<MakeDir Directories="$(PackageDir)" Condition="!Exists('$(PackageDir)')"/>
55

66
<ItemGroup>
7-
<ZipFiles Include="$(StageDir)\**\*.*" Exclude="$(StageDir)\README.md;$(StageDir)\**\*.pdb;$(StageDir)\netstandard2.0\**\*;$(StageDir)\netcoreapp3.1\**\*;$(StageDir)\net7.0*\**\*;$(StageDir)\net8.0*\**\*" />
7+
<ZipFiles Include="$(StageDir)\**\*.*" Exclude="$(StageDir)\README.md;$(StageDir)\**\*.pdb;$(StageDir)\netstandard2.0\**\*;$(StageDir)\netcoreapp3.1\**\*;$(StageDir)\net9.0*\**\*" />
88
<ZipFiles Include="README.md" Link="$(MSBuildThisFileDirectory)README.md" />
99
<ZipFiles Include="scripts/Enter-IronPythonEnvironment.ps1" Link="$(RootDir)Src\Scripts\Enter-IronPythonEnvironment.ps1" />
1010
<ZipFiles Include="scripts/Install-IronPython.ps1" Link="$(RootDir)Src\Scripts\Install-IronPython.ps1" />

Src/DLR

Submodule DLR updated 40 files

Src/IronPython.Modules/IronPython.Modules.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net462;netstandard2.0;net6.0;net7.0</TargetFrameworks>
4+
<TargetFrameworks>net462;netstandard2.0;net6.0;net8.0</TargetFrameworks>
55
<BaseAddress>885063680</BaseAddress>
66
<GenerateDocumentationFile>true</GenerateDocumentationFile>
77
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

Src/IronPython.Modules/_codecs.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ private static Tuple<Bytes, int> DoEncode(CodeContext context, string encodingNa
606606
/// <summary>
607607
/// Optimized encoding mapping that can be consumed by charmap_encode/EncodingMapEncoding.
608608
/// </summary>
609-
[PythonHidden]
609+
[PythonType, PythonHidden]
610610
public class EncodingMap {
611611
private readonly string _smap;
612612
[DisallowNull] private Dictionary<byte, int>? _dmap;

Src/IronPython.Modules/_csv.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ public bool MoveNext() {
643643
// If we ended on an escaped newline, then we want to continue onto
644644
// the nextline without processing the end of this one, as the newline
645645
// is in the middle of the field.
646-
if ((line.EndsWith("\n", StringComparison.Ordinal) || line.EndsWith("\r", StringComparison.Ordinal)) && _state == State.InField) {
646+
if ((line.EndsWith('\n') || line.EndsWith('\r')) && _state == State.InField) {
647647
continue;
648648
}
649649
}

Src/IronPython.Modules/_ctypes/_ctypes.cs

+2
Original file line numberDiff line numberDiff line change
@@ -546,10 +546,12 @@ private static ModuleBuilder DynamicModule {
546546
lock (_nativeTypes) {
547547
if (!_nativeTypes.TryGetValue(size, out Type res)) {
548548
int sizeRemaining = size;
549+
#pragma warning disable SYSLIB0050 // Type or member is obsolete
549550
TypeBuilder tb = DynamicModule.DefineType("interop_type_size_" + size,
550551
TypeAttributes.Public | TypeAttributes.SequentialLayout | TypeAttributes.Sealed | TypeAttributes.Serializable,
551552
typeof(ValueType),
552553
size);
554+
#pragma warning restore SYSLIB0050 // Type or member is obsolete
553555

554556
while (sizeRemaining > 8) {
555557
tb.DefineField("field" + sizeRemaining, typeof(long), FieldAttributes.Private);

Src/IronPython.Modules/_operator.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private static object GetOneAttr(CodeContext context, object param, object val)
5959
int dotPos = s.IndexOf('.');
6060
if (dotPos >= 0) {
6161
object nextParam = GetOneAttr(context, param, s.Substring(0, dotPos));
62-
return GetOneAttr(context, nextParam, s.Substring(dotPos + 1, s.Length - dotPos - 1));
62+
return GetOneAttr(context, nextParam, s.Substring(dotPos + 1));
6363
}
6464
return PythonOps.GetBoundAttr(context, param, s);
6565
}

Src/IronPython.Modules/_socket.cs

+6-10
Original file line numberDiff line numberDiff line change
@@ -2215,10 +2215,6 @@ internal struct WSAData {
22152215
[DllImport("ws2_32.dll", SetLastError = true)]
22162216
private static extern Int32 WSACleanup();
22172217

2218-
private static T PtrToStructure<T>(IntPtr result) {
2219-
return (T)Marshal.PtrToStructure(result, typeof(T))!;
2220-
}
2221-
22222218
public static string GetServiceByPort(ushort port, string? protocol) {
22232219
if (Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX)
22242220
return GetServiceByPortNonWindows(port, protocol);
@@ -2235,9 +2231,9 @@ static string GetServiceByPortWindows(ushort port, string? protocol) {
22352231
throw new SocketUtilException(string.Format("Could not resolve service for port {0}", port));
22362232

22372233
if (Environment.Is64BitProcess)
2238-
return PtrToStructure<servent64>(result).s_name;
2234+
return Marshal.PtrToStructure<servent64>(result).s_name;
22392235
else
2240-
return PtrToStructure<servent>(result).s_name;
2236+
return Marshal.PtrToStructure<servent>(result).s_name;
22412237
}
22422238

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

2251-
return PtrToStructure<servent>(result).s_name;
2247+
return Marshal.PtrToStructure<servent>(result).s_name;
22522248
}
22532249
}
22542250

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

22682264
ushort port;
22692265
if (Environment.Is64BitProcess)
2270-
port = PtrToStructure<servent64>(result).s_port;
2266+
port = Marshal.PtrToStructure<servent64>(result).s_port;
22712267
else
2272-
port = PtrToStructure<servent>(result).s_port;
2268+
port = Marshal.PtrToStructure<servent>(result).s_port;
22732269

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

2285-
ushort port = PtrToStructure<servent>(result).s_port;
2281+
ushort port = Marshal.PtrToStructure<servent>(result).s_port;
22862282
var hostport = IPAddress.NetworkToHostOrder(unchecked((short)port));
22872283
return unchecked((ushort)hostport);
22882284
}

Src/IronPython.Modules/array.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public PythonTuple buffer_info() {
252252
}
253253

254254
public void byteswap() {
255-
Stream s = ToStream();
255+
MemoryStream s = ToStream();
256256
byte[] bytes = new byte[s.Length];
257257
s.Read(bytes, 0, bytes.Length);
258258

@@ -618,7 +618,7 @@ public PythonList tolist() {
618618
}
619619

620620
public Bytes tobytes() {
621-
Stream s = ToStream();
621+
MemoryStream s = ToStream();
622622
byte[] bytes = new byte[s.Length];
623623
s.Read(bytes, 0, (int)s.Length);
624624
return Bytes.Make(bytes);

Src/IronPython.Modules/binascii.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static Bytes a2b_uu_impl(CodeContext/*!*/ context, ReadOnlySpan<byte> data) {
5959
}
6060

6161
using MemoryStream res = DecodeWorker(context, data, true, UuDecFunc);
62-
if (suffix == null) {
62+
if (suffix.IsEmpty) {
6363
var pad = new byte[lenDec - res.Length];
6464
res.Write(pad, 0, pad.Length);
6565
} else {

0 commit comments

Comments
 (0)