Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 122d3af

Browse files
author
Barton Cline
committed
* Resolve version conflict.
* Documented ImplicitLoad deprecation logic in the comments.
1 parent 18c7e9a commit 122d3af

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

pythonnet/src/runtime/assemblymanager.cs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,9 @@ public static Assembly LoadAssemblyPath(string name) {
212212
// namespace. Returns true if any assemblies were loaded.
213213
// TODO item 3 "* Deprecate implicit loading of assemblies":
214214
// Set the fromFile flag if the name of the loaded assembly matches
215-
// the fully qualified name that was requested.
215+
// the fully qualified name that was requested if the framework
216+
// actually loads an assembly.
217+
// Call ONLY for namespaces that HAVE NOT been cached yet.
216218
//===================================================================
217219

218220
public static bool LoadImplicit(string name, out bool fromFile) {
@@ -225,17 +227,26 @@ public static bool LoadImplicit(string name, out bool fromFile) {
225227
for (int i = 0; i < names.Length; i++) {
226228
s = (i == 0) ? names[0] : s + "." + names[i];
227229
if (!probed.ContainsKey(s)) {
228-
if (LoadAssemblyPath(s) != null){
230+
if (LoadAssemblyPath(s) != null) {
229231
loaded = true;
232+
/* 2010-08-16: Deprecation support */
233+
if (s == name) {
234+
fromFile = true;
235+
}
230236
}
231237
else if (LoadAssembly(s) != null) {
232238
loaded = true;
239+
/* 2010-08-16: Deprecation support */
240+
if (s == name) {
241+
fromFile = true;
242+
}
233243
}
234244
probed[s] = 1;
235-
// 2010-12-24: Implicit Load Deprecation logic
236-
if (loaded && (s == name)) {
245+
// 2010-12-24: Deprecation logic
246+
/* if (loaded && (s == name)) {
237247
fromFile = true;
238-
}
248+
break;
249+
} */
239250
}
240251
}
241252
return loaded;

0 commit comments

Comments
 (0)