Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdd5a8de

Browse files
filmorlostmsu
authored andcommitted
We can drop the import hack as we are now using the newer import mechanics
1 parentca1a72b commitdd5a8de

File tree

1 file changed

+0
-31
lines changed

1 file changed

+0
-31
lines changed

‎src/runtime/PythonEngine.cs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
stringcode=
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(PythonExceptione)
357326
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp