Skip to content
This repository was archived by the owner on Jul 22, 2023. It is now read-only.

Commit 3a8c72d

Browse files
committed
Rename PyObjectSerializeContext
to InterDomainContext Addresses Comment: pythonnet#958
1 parent 0fdf969 commit 3a8c72d

File tree

9 files changed

+26
-26
lines changed

9 files changed

+26
-26
lines changed

src/runtime/classbase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ public static int tp_clear(IntPtr ob)
305305
return 0;
306306
}
307307

308-
protected override void OnSave(PyObjectSerializeContext context)
308+
protected override void OnSave(InterDomainContext context)
309309
{
310310
base.OnSave(context);
311311
if (pyHandle != tpHandle)
@@ -316,7 +316,7 @@ protected override void OnSave(PyObjectSerializeContext context)
316316
}
317317
}
318318

319-
protected override void OnLoad(PyObjectSerializeContext context)
319+
protected override void OnLoad(InterDomainContext context)
320320
{
321321
base.OnLoad(context);
322322
if (pyHandle != tpHandle)

src/runtime/classmanager.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,23 +80,23 @@ private static int OnVisit(IntPtr ob, IntPtr arg)
8080
internal static void StashPush(RuntimeDataStorage storage)
8181
{
8282
var contexts = storage.AddValue("contexts",
83-
new Dictionary<IntPtr, PyObjectSerializeContext>());
83+
new Dictionary<IntPtr, InterDomainContext>());
8484
storage.AddValue("cache", cache);
8585
foreach (var cls in cache.Values)
8686
{
8787
// This incref is for cache to hold the cls,
8888
// thus no need for decreasing it at StashPop.
8989
Runtime.XIncref(cls.pyHandle);
90-
var context = contexts[cls.pyHandle] = new PyObjectSerializeContext();
90+
var context = contexts[cls.pyHandle] = new InterDomainContext();
9191
cls.Save(context);
9292
}
9393
}
9494

95-
internal static Dictionary<ManagedType, PyObjectSerializeContext> StashPop(RuntimeDataStorage storage)
95+
internal static Dictionary<ManagedType, InterDomainContext> StashPop(RuntimeDataStorage storage)
9696
{
9797
cache = storage.GetValue<Dictionary<Type, ClassBase>>("cache");
98-
var contexts = storage.GetValue <Dictionary<IntPtr, PyObjectSerializeContext>>("contexts");
99-
var loadedObjs = new Dictionary<ManagedType, PyObjectSerializeContext>();
98+
var contexts = storage.GetValue <Dictionary<IntPtr, InterDomainContext>>("contexts");
99+
var loadedObjs = new Dictionary<ManagedType, InterDomainContext>();
100100
foreach (var cls in cache.Values)
101101
{
102102
var context = contexts[cls.pyHandle];

src/runtime/clrobject.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ internal static IntPtr GetInstHandle(object ob)
7373
return co.pyHandle;
7474
}
7575

76-
internal static CLRObject Restore(object ob, IntPtr pyHandle, PyObjectSerializeContext context)
76+
internal static CLRObject Restore(object ob, IntPtr pyHandle, InterDomainContext context)
7777
{
7878
CLRObject co = new CLRObject()
7979
{
@@ -85,13 +85,13 @@ internal static CLRObject Restore(object ob, IntPtr pyHandle, PyObjectSerializeC
8585
return co;
8686
}
8787

88-
protected override void OnSave(PyObjectSerializeContext context)
88+
protected override void OnSave(InterDomainContext context)
8989
{
9090
base.OnSave(context);
9191
Runtime.XIncref(pyHandle);
9292
}
9393

94-
protected override void OnLoad(PyObjectSerializeContext context)
94+
protected override void OnLoad(InterDomainContext context)
9595
{
9696
base.OnLoad(context);
9797
GCHandle gc = AllocGCHandle(TrackTypes.Wrapper);

src/runtime/extensiontype.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public static void tp_dealloc(IntPtr ob)
9898
self.Dealloc();
9999
}
100100

101-
protected override void OnLoad(PyObjectSerializeContext context)
101+
protected override void OnLoad(InterDomainContext context)
102102
{
103103
base.OnLoad(context);
104104
GCHandle gc = AllocGCHandle(TrackTypes.Extension);

src/runtime/managedtype.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,18 +205,18 @@ protected void TypeClear()
205205
ClearObjectDict(pyHandle);
206206
}
207207

208-
internal void Save(PyObjectSerializeContext context)
208+
internal void Save(InterDomainContext context)
209209
{
210210
OnSave(context);
211211
}
212212

213-
internal void Load(PyObjectSerializeContext context)
213+
internal void Load(InterDomainContext context)
214214
{
215215
OnLoad(context);
216216
}
217217

218-
protected virtual void OnSave(PyObjectSerializeContext context) { }
219-
protected virtual void OnLoad(PyObjectSerializeContext context) { }
218+
protected virtual void OnSave(InterDomainContext context) { }
219+
protected virtual void OnLoad(InterDomainContext context) { }
220220

221221
protected static void ClearObjectDict(IntPtr ob)
222222
{

src/runtime/methodbinding.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ public static int tp_clear(IntPtr ob)
255255
return 0;
256256
}
257257

258-
protected override void OnSave(PyObjectSerializeContext context)
258+
protected override void OnSave(InterDomainContext context)
259259
{
260260
base.OnSave(context);
261261
Runtime.XIncref(target);

src/runtime/methodobject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public static int tp_clear(IntPtr ob)
222222
return 0;
223223
}
224224

225-
protected override void OnSave(PyObjectSerializeContext context)
225+
protected override void OnSave(InterDomainContext context)
226226
{
227227
base.OnSave(context);
228228
if (unbound != null)

src/runtime/moduleobject.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ public static int tp_clear(IntPtr ob)
349349
return 0;
350350
}
351351

352-
protected override void OnSave(PyObjectSerializeContext context)
352+
protected override void OnSave(InterDomainContext context)
353353
{
354354
base.OnSave(context);
355355
System.Diagnostics.Debug.Assert(dict == GetObjectDict(pyHandle));
@@ -362,7 +362,7 @@ protected override void OnSave(PyObjectSerializeContext context)
362362
Runtime.XIncref(dict);
363363
}
364364

365-
protected override void OnLoad(PyObjectSerializeContext context)
365+
protected override void OnLoad(InterDomainContext context)
366366
{
367367
base.OnLoad(context);
368368
SetObjectDict(pyHandle, dict);

src/runtime/runtime_data.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ private static void StashPushObjects(RuntimeDataStorage storage)
143143
var extensionObjs = new List<ManagedType>();
144144
var wrappers = new Dictionary<object, List<CLRObject>>();
145145
var serializeObjs = new CLRWrapperCollection();
146-
var contexts = new Dictionary<IntPtr, PyObjectSerializeContext>();
146+
var contexts = new Dictionary<IntPtr, InterDomainContext>();
147147
foreach (var entry in objs)
148148
{
149149
var obj = entry.Key;
@@ -152,7 +152,7 @@ private static void StashPushObjects(RuntimeDataStorage storage)
152152
{
153153
case ManagedType.TrackTypes.Extension:
154154
Debug.Assert(obj.GetType().IsSerializable);
155-
var context = new PyObjectSerializeContext();
155+
var context = new InterDomainContext();
156156
contexts[obj.pyHandle] = context;
157157
obj.Save(context);
158158
extensionObjs.Add(obj);
@@ -204,7 +204,7 @@ private static void StashPushObjects(RuntimeDataStorage storage)
204204
foreach (var clrObj in wrappers[item.Instance])
205205
{
206206
XIncref(clrObj.pyHandle);
207-
var context = new PyObjectSerializeContext();
207+
var context = new InterDomainContext();
208208
contexts[clrObj.pyHandle] = context;
209209
clrObj.Save(context);
210210
}
@@ -215,12 +215,12 @@ private static void StashPushObjects(RuntimeDataStorage storage)
215215
storage.AddValue("contexts", contexts);
216216
}
217217

218-
private static Dictionary<ManagedType, PyObjectSerializeContext> StashPopObjects(RuntimeDataStorage storage)
218+
private static Dictionary<ManagedType, InterDomainContext> StashPopObjects(RuntimeDataStorage storage)
219219
{
220220
var extensions = storage.GetValue<List<ManagedType>>("extensions");
221221
var internalStores = storage.GetValue<List<CLRObject>>("internalStores");
222-
var contexts = storage.GetValue <Dictionary<IntPtr, PyObjectSerializeContext>>("contexts");
223-
var storedObjs = new Dictionary<ManagedType, PyObjectSerializeContext>();
222+
var contexts = storage.GetValue <Dictionary<IntPtr, InterDomainContext>>("contexts");
223+
var storedObjs = new Dictionary<ManagedType, InterDomainContext>();
224224
foreach (var obj in Enumerable.Union(extensions, internalStores))
225225
{
226226
var context = contexts[obj.pyHandle];
@@ -356,7 +356,7 @@ public T PopValue<T>(out T value)
356356

357357

358358
[Serializable]
359-
class PyObjectSerializeContext
359+
class InterDomainContext
360360
{
361361
private RuntimeDataStorage _storage;
362362
public RuntimeDataStorage Storage => _storage ?? (_storage = new RuntimeDataStorage());

0 commit comments

Comments
 (0)