diff --git a/Directory.Build.props b/Directory.Build.props
index 6716f29df..d724e41e7 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -4,7 +4,6 @@
Copyright (c) 2006-2021 The Contributors of the Python.NET Project
pythonnet
Python.NET
- 10.0
false
diff --git a/src/embed_tests/StateSerialization/MethodSerialization.cs b/src/embed_tests/StateSerialization/MethodSerialization.cs
index 80b7a08ee..21a6cfa52 100644
--- a/src/embed_tests/StateSerialization/MethodSerialization.cs
+++ b/src/embed_tests/StateSerialization/MethodSerialization.cs
@@ -1,4 +1,4 @@
-using System.IO;
+/*using System.IO;
using System.Reflection;
using NUnit.Framework;
@@ -44,3 +44,4 @@ public class MethodTestHost
public MethodTestHost(int _) { }
public void Generic(T item, T[] array, ref T @ref) { }
}
+*/
diff --git a/src/runtime/MethodBinder.cs b/src/runtime/MethodBinder.cs
index 25dd76621..8c8bac65d 100644
--- a/src/runtime/MethodBinder.cs
+++ b/src/runtime/MethodBinder.cs
@@ -793,7 +793,6 @@ internal Binding Bind(BorrowedReference inst, BorrowedReference args, BorrowedRe
static BorrowedReference HandleParamsArray(BorrowedReference args, int arrayStart, int pyArgCount, out NewReference tempObject)
{
- BorrowedReference op;
tempObject = default;
// for a params method, we may have a sequence or single/multiple items
// here we look to see if the item at the paramIndex is there or not
@@ -806,20 +805,19 @@ static BorrowedReference HandleParamsArray(BorrowedReference args, int arrayStar
if (!Runtime.PyString_Check(item) && (Runtime.PySequence_Check(item) || (ManagedType.GetManagedObject(item) as CLRObject)?.inst is IEnumerable))
{
// it's a sequence (and not a string), so we use it as the op
- op = item;
+ return item;
}
else
{
tempObject = Runtime.PyTuple_GetSlice(args, arrayStart, pyArgCount);
- op = tempObject.Borrow();
+ return tempObject.Borrow();
}
}
else
{
tempObject = Runtime.PyTuple_GetSlice(args, arrayStart, pyArgCount);
- op = tempObject.Borrow();
+ return tempObject.Borrow();
}
- return op;
}
///
diff --git a/src/runtime/Native/NewReference.cs b/src/runtime/Native/NewReference.cs
index 00e01d75f..456503b41 100644
--- a/src/runtime/Native/NewReference.cs
+++ b/src/runtime/Native/NewReference.cs
@@ -15,7 +15,7 @@ ref struct NewReference
/// Creates a pointing to the same object
[DebuggerHidden]
- public NewReference(BorrowedReference reference, bool canBeNull = false)
+ public NewReference(scoped BorrowedReference reference, bool canBeNull = false)
{
var address = canBeNull
? reference.DangerousGetAddressOrNull()
@@ -157,15 +157,15 @@ public static bool IsNull(this in NewReference reference)
[Pure]
[DebuggerHidden]
- public static BorrowedReference BorrowNullable(this in NewReference reference)
+ public static BorrowedReference BorrowNullable(this scoped in NewReference reference)
=> new(NewReference.DangerousGetAddressOrNull(reference));
[Pure]
[DebuggerHidden]
- public static BorrowedReference Borrow(this in NewReference reference)
+ public static BorrowedReference Borrow(this scoped in NewReference reference)
=> reference.IsNull() ? throw new NullReferenceException() : reference.BorrowNullable();
[Pure]
[DebuggerHidden]
- public static BorrowedReference BorrowOrThrow(this in NewReference reference)
+ public static BorrowedReference BorrowOrThrow(this scoped in NewReference reference)
=> reference.IsNull() ? throw PythonException.ThrowLastAsClrException() : reference.BorrowNullable();
}
}
diff --git a/src/runtime/Native/StolenReference.cs b/src/runtime/Native/StolenReference.cs
index 49304c1fd..14c3a6995 100644
--- a/src/runtime/Native/StolenReference.cs
+++ b/src/runtime/Native/StolenReference.cs
@@ -28,7 +28,7 @@ public static StolenReference Take(ref IntPtr ptr)
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[DebuggerHidden]
- public static StolenReference TakeNullable(ref IntPtr ptr)
+ public static StolenReference TakeNullable(scoped ref IntPtr ptr)
{
var stolenAddr = ptr;
ptr = IntPtr.Zero;
diff --git a/src/runtime/Runtime.Delegates.cs b/src/runtime/Runtime.Delegates.cs
index 5a6e0507d..ea139d965 100644
--- a/src/runtime/Runtime.Delegates.cs
+++ b/src/runtime/Runtime.Delegates.cs
@@ -59,9 +59,9 @@ static Delegates()
Py_GetCompiler = (delegate* unmanaged[Cdecl])GetFunctionByName(nameof(Py_GetCompiler), GetUnmanagedDll(_PythonDll));
Py_GetBuildInfo = (delegate* unmanaged[Cdecl])GetFunctionByName(nameof(Py_GetBuildInfo), GetUnmanagedDll(_PythonDll));
PyRun_SimpleStringFlags = (delegate* unmanaged[Cdecl])GetFunctionByName(nameof(PyRun_SimpleStringFlags), GetUnmanagedDll(_PythonDll));
- PyRun_StringFlags = (delegate* unmanaged[Cdecl])GetFunctionByName(nameof(PyRun_StringFlags), GetUnmanagedDll(_PythonDll));
+ PyRun_StringFlags = (delegate* unmanaged[Cdecl])GetFunctionByName(nameof(PyRun_StringFlags), GetUnmanagedDll(_PythonDll));
PyEval_EvalCode = (delegate* unmanaged[Cdecl])GetFunctionByName(nameof(PyEval_EvalCode), GetUnmanagedDll(_PythonDll));
- Py_CompileStringObject = (delegate* unmanaged[Cdecl])GetFunctionByName(nameof(Py_CompileStringObject), GetUnmanagedDll(_PythonDll));
+ Py_CompileStringObject = (delegate* unmanaged[Cdecl])GetFunctionByName(nameof(Py_CompileStringObject), GetUnmanagedDll(_PythonDll));
PyImport_ExecCodeModule = (delegate* unmanaged[Cdecl])GetFunctionByName(nameof(PyImport_ExecCodeModule), GetUnmanagedDll(_PythonDll));
PyObject_HasAttrString = (delegate* unmanaged[Cdecl])GetFunctionByName(nameof(PyObject_HasAttrString), GetUnmanagedDll(_PythonDll));
PyObject_GetAttrString = (delegate* unmanaged[Cdecl])GetFunctionByName(nameof(PyObject_GetAttrString), GetUnmanagedDll(_PythonDll));
@@ -345,9 +345,9 @@ static Delegates()
internal static delegate* unmanaged[Cdecl] Py_GetCompiler { get; }
internal static delegate* unmanaged[Cdecl] Py_GetBuildInfo { get; }
internal static delegate* unmanaged[Cdecl] PyRun_SimpleStringFlags { get; }
- internal static delegate* unmanaged[Cdecl] PyRun_StringFlags { get; }
+ internal static delegate* unmanaged[Cdecl] PyRun_StringFlags { get; }
internal static delegate* unmanaged[Cdecl] PyEval_EvalCode { get; }
- internal static delegate* unmanaged[Cdecl] Py_CompileStringObject { get; }
+ internal static delegate* unmanaged[Cdecl] Py_CompileStringObject { get; }
internal static delegate* unmanaged[Cdecl] PyImport_ExecCodeModule { get; }
internal static delegate* unmanaged[Cdecl] PyObject_HasAttrString { get; }
internal static delegate* unmanaged[Cdecl] PyObject_GetAttrString { get; }
diff --git a/src/runtime/Runtime.cs b/src/runtime/Runtime.cs
index a4a6acb05..0dfc7e36f 100644
--- a/src/runtime/Runtime.cs
+++ b/src/runtime/Runtime.cs
@@ -157,15 +157,8 @@ internal static void Initialize(bool initSigs = false)
// Initialize modules that depend on the runtime class.
AssemblyManager.Initialize();
OperatorMethod.Initialize();
- if (RuntimeData.HasStashData())
- {
- RuntimeData.RestoreRuntimeData();
- }
- else
- {
- PyCLRMetaType = MetaType.Initialize();
- ImportHook.Initialize();
- }
+ PyCLRMetaType = MetaType.Initialize();
+ ImportHook.Initialize();
Exceptions.Initialize();
// Need to add the runtime directory to sys.path so that we
@@ -269,8 +262,6 @@ internal static void Shutdown()
{
// avoid saving dead objects
TryCollectingGarbage(runs: 3);
-
- RuntimeData.Stash();
}
AssemblyManager.Shutdown();
@@ -1715,7 +1706,7 @@ internal static bool PyType_IsSameAsOrSubtype(BorrowedReference type, BorrowedRe
internal static NewReference PyType_GenericAlloc(BorrowedReference type, nint n) => Delegates.PyType_GenericAlloc(type, n);
internal static IntPtr PyType_GetSlot(BorrowedReference type, TypeSlotID slot) => Delegates.PyType_GetSlot(type, slot);
- internal static NewReference PyType_FromSpecWithBases(in NativeTypeSpec spec, BorrowedReference bases) => Delegates.PyType_FromSpecWithBases(in spec, bases);
+ internal static NewReference PyType_FromSpecWithBases(scoped in NativeTypeSpec spec, BorrowedReference bases) => Delegates.PyType_FromSpecWithBases(in spec, bases);
///
/// Finalize a type object. This should be called on all type objects to finish their initialization. This function is responsible for adding inherited slots from a type�s base class. Return 0 on success, or return -1 and sets an exception on error.
diff --git a/src/runtime/StateSerialization/RuntimeData.cs b/src/runtime/StateSerialization/RuntimeData.cs
index a60796a87..20d9e2e8a 100644
--- a/src/runtime/StateSerialization/RuntimeData.cs
+++ b/src/runtime/StateSerialization/RuntimeData.cs
@@ -1,4 +1,4 @@
-using System;
+/*using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -210,3 +210,4 @@ internal static IFormatter CreateFormatter()
}
}
}
+*/