diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 2518f77fb..31cc3ea8d 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.0.5.13 +current_version = 1.0.5.14 parse = (?P\d+)\.(?P\d+)\.(?P\d+)(\.(?P[a-z]+)(?P\d+))? serialize = {major}.{minor}.{patch}.{release}{dev} diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml index 3aa2d1a62..e1b225169 100644 --- a/conda.recipe/meta.yaml +++ b/conda.recipe/meta.yaml @@ -1,6 +1,6 @@ package: name: pythonnet - version: "1.0.5.13" + version: "1.0.5.14" build: skip: True # [not win] diff --git a/setup.py b/setup.py index 3695e33fa..ddb59747c 100644 --- a/setup.py +++ b/setup.py @@ -485,7 +485,7 @@ def run(self): setup( name="pythonnet", - version="1.0.5.13", + version="1.0.5.14", description=".Net and Mono integration for Python", url='https://pythonnet.github.io/', license='MIT', diff --git a/src/SharedAssemblyInfo.cs b/src/SharedAssemblyInfo.cs index e9d39ba33..1df774b4a 100644 --- a/src/SharedAssemblyInfo.cs +++ b/src/SharedAssemblyInfo.cs @@ -25,4 +25,4 @@ // Version Information. Keeping it simple. May need to revisit for Nuget // See: https://codingforsmarties.wordpress.com/2016/01/21/how-to-version-assemblies-destined-for-nuget/ // AssemblyVersion can only be numeric -[assembly: AssemblyVersion("1.0.5.13")] +[assembly: AssemblyVersion("1.0.5.14")] diff --git a/src/clrmodule/ClrModule.cs b/src/clrmodule/ClrModule.cs index c5b789a18..3384b6c5e 100644 --- a/src/clrmodule/ClrModule.cs +++ b/src/clrmodule/ClrModule.cs @@ -53,7 +53,7 @@ public static void initclr() { #if USE_PYTHON_RUNTIME_VERSION // Has no effect until SNK works. Keep updated anyways. - Version = new Version("1.0.5.12"), + Version = new Version("1.0.5.14"), #endif CultureInfo = CultureInfo.InvariantCulture }; diff --git a/src/runtime/clrobject.cs b/src/runtime/clrobject.cs index fb3d0e0d7..17782f026 100644 --- a/src/runtime/clrobject.cs +++ b/src/runtime/clrobject.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.InteropServices; namespace Python.Runtime @@ -29,9 +29,13 @@ internal CLRObject(object ob, IntPtr tp) gcHandle = gc; inst = ob; - // Fix the BaseException args (and __cause__ in case of Python 3) - // slot if wrapping a CLR exception - Exceptions.SetArgsAndCause(py); + // for performance before calling SetArgsAndCause() lets check if we are an exception + if (inst is Exception) + { + // Fix the BaseException args (and __cause__ in case of Python 3) + // slot if wrapping a CLR exception + Exceptions.SetArgsAndCause(py); + } } diff --git a/src/runtime/pyobject.cs b/src/runtime/pyobject.cs index 0e075824a..35a4e6fa9 100644 --- a/src/runtime/pyobject.cs +++ b/src/runtime/pyobject.cs @@ -101,7 +101,7 @@ public object AsManagedObject(Type t) } return result; } - + /// /// As Method /// @@ -156,6 +156,23 @@ public void Dispose() GC.SuppressFinalize(this); } + /// + /// Unsafe Dispose Method. + /// To be used when already owning the GIL lock. + /// + public void UnsafeDispose() + { + if (!disposed) + { + if (!Runtime.IsFinalizing) + { + Runtime.XDecref(obj); + obj = IntPtr.Zero; + } + disposed = true; + } + GC.SuppressFinalize(this); + } /// /// GetPythonType Method diff --git a/src/runtime/resources/clr.py b/src/runtime/resources/clr.py index 7caff08f4..48d2907c4 100644 --- a/src/runtime/resources/clr.py +++ b/src/runtime/resources/clr.py @@ -2,7 +2,7 @@ Code in this module gets loaded into the main clr module. """ -__version__ = "1.0.5.13" +__version__ = "1.0.5.14" class clrproperty(object):