@@ -153,6 +153,16 @@ internal static void Initialize(bool initSigs = false, ShutdownMode mode = Shutd
153153 ClassDerivedObject . Reset ( ) ;
154154 TypeManager . Initialize ( ) ;
155155
156+ // Need to add the runtime directory to sys.path so that we
157+ // can find built-in assemblies like System.Data, et. al.
158+ string rtdir = RuntimeEnvironment . GetRuntimeDirectory ( ) ;
159+ IntPtr path = PySys_GetObject ( "path" ) . DangerousGetAddress ( ) ;
160+ IntPtr item = PyString_FromString ( rtdir ) ;
161+ if ( PySequence_Contains ( path , item ) == 0 )
162+ {
163+ PyList_Append ( new BorrowedReference ( path ) , item ) ;
164+ }
165+ XDecref ( item ) ;
156166 // Initialize modules that depend on the runtime class.
157167 AssemblyManager . Initialize ( ) ;
158168 OperatorMethod . Initialize ( ) ;
@@ -167,16 +177,6 @@ internal static void Initialize(bool initSigs = false, ShutdownMode mode = Shutd
167177 }
168178 Exceptions . Initialize ( ) ;
169179
170- // Need to add the runtime directory to sys.path so that we
171- // can find built-in assemblies like System.Data, et. al.
172- string rtdir = RuntimeEnvironment . GetRuntimeDirectory ( ) ;
173- IntPtr path = PySys_GetObject ( "path" ) . DangerousGetAddress ( ) ;
174- IntPtr item = PyString_FromString ( rtdir ) ;
175- if ( PySequence_Contains ( path , item ) == 0 )
176- {
177- PyList_Append ( new BorrowedReference ( path ) , item ) ;
178- }
179- XDecref ( item ) ;
180180 AssemblyManager . UpdatePath ( ) ;
181181 }
182182
0 commit comments