File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -107,24 +107,25 @@ internal static void Shutdown()
107107 }
108108
109109 RestoreImport ( ) ;
110-
111110 bool shouldFreeDef = Runtime . Refcount ( py_clr_module ) == 1 ;
112- Runtime . XDecref ( py_clr_module ) ;
113- py_clr_module = IntPtr . Zero ;
114- if ( shouldFreeDef )
111+ #if ! NETSTANDARD
112+ if ( Runtime . ShutdownMode != ShutdownMode . Reload )
113+ #endif
115114 {
116- ReleaseModuleDef ( ) ;
115+ Runtime . XDecref ( py_clr_module ) ;
116+ py_clr_module = IntPtr . Zero ;
117+ if ( shouldFreeDef )
118+ {
119+ ReleaseModuleDef ( ) ;
120+ }
121+ Runtime . XDecref ( root . pyHandle ) ;
117122 }
118-
119- Runtime . XDecref ( root . pyHandle ) ;
120123 root = null ;
121124 CLRModule . Reset ( ) ;
122125 }
123126
124127 internal static void SaveRuntimeData ( RuntimeDataStorage storage )
125128 {
126- Runtime . XIncref ( py_clr_module ) ;
127- Runtime . XIncref ( root . pyHandle ) ;
128129 storage . AddValue ( "py_clr_module" , py_clr_module ) ;
129130 storage . AddValue ( "root" , root . pyHandle ) ;
130131 }
You can’t perform that action at this time.
0 commit comments