@@ -321,37 +321,6 @@ public static IntPtr InitExt()
321321 Initialize ( setSysArgv : false ) ;
322322
323323 Finalizer . Instance . ErrorHandler += AllowLeaksDuringShutdown ;
324-
325- // Trickery - when the import hook is installed into an already
326- // running Python, the standard import machinery is still in
327- // control for the duration of the import that caused bootstrap.
328- //
329- // That is problematic because the std machinery tries to get
330- // sub-names directly from the module __dict__ rather than going
331- // through our module object's getattr hook. This workaround is
332- // evil ;) We essentially climb up the stack looking for the
333- // import that caused the bootstrap to happen, then re-execute
334- // the import explicitly after our hook has been installed. By
335- // doing this, the original outer import should work correctly.
336- //
337- // Note that this is only needed during the execution of the
338- // first import that installs the CLR import hook. This hack
339- // still doesn't work if you use the interactive interpreter,
340- // since there is no line info to get the import line ;(
341-
342- string code =
343- "import traceback\n " +
344- "for item in traceback.extract_stack():\n " +
345- " line = item[3]\n " +
346- " if line is not None:\n " +
347- " if line.startswith('import CLR') or \\ \n " +
348- " line.startswith('import clr') or \\ \n " +
349- " line.startswith('from clr') or \\ \n " +
350- " line.startswith('from CLR'):\n " +
351- " exec(line)\n " +
352- " break\n " ;
353-
354- PythonEngine . Exec ( code ) ;
355324 }
356325 catch ( PythonException e )
357326 {
0 commit comments