Example #1
0
        /// <summary>
        /// Cleanup resources upon shutdown of the Python runtime.
        /// </summary>
        internal static void Shutdown()
        {
            if (Runtime.Py_IsInitialized() == 0)
            {
                return;
            }

            TeardownNameSpaceTracking();
            Runtime.XDecref(py_clr_module);
            py_clr_module = IntPtr.Zero;

            Runtime.XDecref(root.pyHandle);
            root = null;
            CLRModule.Reset();
        }
Example #2
0
        /// <summary>
        /// Cleanup resources upon shutdown of the Python runtime.
        /// </summary>
        internal static void Shutdown()
        {
            if (Runtime.Py_IsInitialized() == 0)
            {
                return;
            }

            RestoreImport();

            Runtime.XDecref(py_clr_module);
            py_clr_module = IntPtr.Zero;

            Runtime.XDecref(root.pyHandle);
            root = null;
            CLRModule.Reset();
        }
Example #3
0
        /// <summary>
        /// Cleanup resources upon shutdown of the Python runtime.
        /// </summary>
        internal static void Shutdown()
        {
            if (Runtime.Py_IsInitialized() == 0)
            {
                return;
            }

            RestoreImport();

            bool shouldFreeDef = Runtime.Refcount(py_clr_module) == 1;

            Runtime.XDecref(py_clr_module);
            py_clr_module = IntPtr.Zero;
            if (shouldFreeDef)
            {
                ReleaseModuleDef();
            }

            Runtime.XDecref(root.pyHandle);
            root = null;
            CLRModule.Reset();
        }