Skip to content

Commit c1e86ed

Browse files
authored
Polyfill Encoding.GetString (#2041)
* Polyfill Encoding.GetString * Bump Meziantou.Polyfill to 1.0.140
1 parent 76e1224 commit c1e86ed

3 files changed

Lines changed: 4 additions & 11 deletions

File tree

src/core/IronPython.Modules/IronPython.Modules.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
T:System.Runtime.Versioning.SupportedOSPlatformAttribute;
1616
M:System.String.Contains(System.Char);
1717
M:System.String.EndsWith(System.Char);
18+
M:System.Text.Encoding.GetString(System.ReadOnlySpan{System.Byte});
1819
</MeziantouPolyfill_IncludedPolyfills>
1920
</PropertyGroup>
2021

@@ -44,7 +45,7 @@
4445
</ItemGroup>
4546

4647
<ItemGroup>
47-
<PackageReference Include="Meziantou.Polyfill" Version="1.0.127">
48+
<PackageReference Include="Meziantou.Polyfill" Version="1.0.140">
4849
<PrivateAssets>all</PrivateAssets>
4950
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
5051
</PackageReference>

src/core/IronPython/IronPython.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
M:System.String.Contains(System.Char);
2020
M:System.String.EndsWith(System.Char);
2121
M:System.String.StartsWith(System.Char);
22+
M:System.Text.Encoding.GetString(System.ReadOnlySpan{System.Byte});
2223
</MeziantouPolyfill_IncludedPolyfills>
2324
</PropertyGroup>
2425

@@ -65,7 +66,7 @@
6566
</ItemGroup>
6667

6768
<ItemGroup>
68-
<PackageReference Include="Meziantou.Polyfill" Version="1.0.127">
69+
<PackageReference Include="Meziantou.Polyfill" Version="1.0.140">
6970
<PrivateAssets>all</PrivateAssets>
7071
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
7172
</PackageReference>

src/core/IronPython/Runtime/PythonEncoding.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,15 +1532,6 @@ public override unsafe int GetChars(byte* bytes, int byteCount, char* chars, int
15321532
#if !NETCOREAPP
15331533
// TODO: Move to IronPython.Runtime.Text
15341534

1535-
internal static class EncodingExtensions {
1536-
public static unsafe string GetString(this Encoding encoding, ReadOnlySpan<byte> bytes) {
1537-
fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes)) {
1538-
return encoding.GetString(bytesPtr, bytes.Length);
1539-
}
1540-
1541-
}
1542-
}
1543-
15441535
internal static class EncoderExtensions {
15451536
public static unsafe int GetByteCount(this Encoder encoder, ReadOnlySpan<char> chars, bool flush) {
15461537
fixed (char* pChars = &MemoryMarshal.GetReference(chars)) {

0 commit comments

Comments
 (0)