◐ Shell
reader mode source ↗
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ This document follows the conventions laid out in [Keep a CHANGELOG][].
### Added

### Changed

### Fixed

Expand Down
14 changes: 14 additions & 0 deletions src/runtime/StateSerialization/NoopFormatter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
138 changes: 132 additions & 6 deletions src/runtime/StateSerialization/RuntimeData.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
Expand All @@ -17,7 +15,34 @@ namespace Python.Runtime
{
public static class RuntimeData
{
private static Type? _formatterType;
public static Type? FormatterType
{
get => _formatterType;
Expand All @@ -31,6 +56,14 @@ public static Type? FormatterType
}
}

public static ICLRObjectStorer? WrappersStorer { get; set; }

/// <summary>
Expand Down Expand Up @@ -74,6 +107,7 @@ internal static void Stash()
using NewReference capsule = PyCapsule_New(mem, IntPtr.Zero, IntPtr.Zero);
int res = PySys_SetObject("clr_data", capsule.BorrowOrThrow());
PythonException.ThrowIfIsNotZero(res);
}

internal static void RestoreRuntimeData()
@@ -90,6 +124,7 @@ internal static void RestoreRuntimeData()

private static void RestoreRuntimeDataImpl()
{
BorrowedReference capsule = PySys_GetObject("clr_data");
if (capsule.IsNull)
{
Expand Down Expand Up @@ -250,11 +285,102 @@ private static void RestoreRuntimeDataObjects(SharedObjectsState storage)
}
}

internal static IFormatter CreateFormatter()
{
return FormatterType != null ?
(IFormatter)Activator.CreateInstance(FormatterType)
: new BinaryFormatter();
}
}
}
Toggle all file notes Toggle all file annotations