Skip to content

Commit 481f4d0

Browse files
committed
Reflect PR #34
1 parent de0328c commit 481f4d0

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/runtime/pythonengine.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ public static void Initialize(IEnumerable<string> args, bool setSysArgv = true,
182182
// during an initial "import clr", and the world ends shortly thereafter.
183183
// This is probably masking some bad mojo happening somewhere in Runtime.Initialize().
184184
delegateManager = new DelegateManager();
185+
Console.WriteLine("PythonEngine.Initialize(): Runtime.Initialize()...");
185186
Runtime.Initialize(initSigs, mode);
186187
initialized = true;
187188
Exceptions.Clear();
@@ -199,6 +200,7 @@ public static void Initialize(IEnumerable<string> args, bool setSysArgv = true,
199200
}
200201

201202
// Load the clr.py resource into the clr module
203+
Console.WriteLine("PythonEngine.Initialize(): GetCLRModule()...");
202204
NewReference clr = Python.Runtime.ImportHook.GetCLRModule();
203205
BorrowedReference clr_dict = Runtime.PyModule_GetDict(clr);
204206

@@ -210,6 +212,7 @@ public static void Initialize(IEnumerable<string> args, bool setSysArgv = true,
210212
BorrowedReference builtins = Runtime.PyEval_GetBuiltins();
211213
Runtime.PyDict_SetItemString(module_globals, "__builtins__", builtins);
212214

215+
Console.WriteLine("PythonEngine.Initialize(): clr GetManifestResourceStream...");
213216
Assembly assembly = Assembly.GetExecutingAssembly();
214217
using (Stream stream = assembly.GetManifestResourceStream("clr.py"))
215218
using (var reader = new StreamReader(stream))

src/runtime/runtime.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,11 @@ internal static void Initialize(bool initSigs = false, ShutdownMode mode = Shutd
116116

117117
if (Py_IsInitialized() == 0)
118118
{
119+
Console.WriteLine("Runtime.Initialize(): Py_Initialize...");
119120
Py_InitializeEx(initSigs ? 1 : 0);
120121
if (PyEval_ThreadsInitialized() == 0)
121122
{
123+
Console.WriteLine("Runtime.Initialize(): PyEval_InitThreads...");
122124
PyEval_InitThreads();
123125
}
124126
// XXX: Reload mode may reduct to Soft mode,
@@ -143,7 +145,9 @@ internal static void Initialize(bool initSigs = false, ShutdownMode mode = Shutd
143145
IsFinalizing = false;
144146
InternString.Initialize();
145147

148+
Console.WriteLine("Runtime.Initialize(): Initialize types...");
146149
InitPyMembers();
150+
Console.WriteLine("Runtime.Initialize(): Initialize types end.");
147151

148152
ABI.Initialize(PyVersion,
149153
pyType: new BorrowedReference(PyTypeType));
@@ -155,6 +159,7 @@ internal static void Initialize(bool initSigs = false, ShutdownMode mode = Shutd
155159
TypeManager.Initialize();
156160

157161
// Initialize modules that depend on the runtime class.
162+
Console.WriteLine("Runtime.Initialize(): AssemblyManager.Initialize()...");
158163
AssemblyManager.Initialize();
159164
OperatorMethod.Initialize();
160165
if (mode == ShutdownMode.Reload && RuntimeData.HasStashData())
@@ -178,6 +183,7 @@ internal static void Initialize(bool initSigs = false, ShutdownMode mode = Shutd
178183
PyList_Append(new BorrowedReference(path), item);
179184
}
180185
XDecref(item);
186+
Console.WriteLine("Runtime.Initialize(): AssemblyManager.UpdatePath()...");
181187
AssemblyManager.UpdatePath();
182188
}
183189

0 commit comments

Comments
 (0)