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

Skip to content

Commit 73f191f

Browse files
author
Barton Cline
committed
The implicit load deprecation logic is just as readable in 3 lines rather than 6 (perhaps more so).
1 parent 5d9d65d commit 73f191f

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

pythonnet/src/runtime/assemblymanager.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,9 @@ public static Assembly LoadAssemblyPath(string name) {
210210
// an assembly named after each of A.B.C.D, A.B.C, A.B, A. This
211211
// will only actually probe for the assembly once for each unique
212212
// namespace. Returns true if any assemblies were loaded.
213-
// TODO item 3 "* Deprecate implicit loading of assemblies"
213+
// TODO item 3 "* Deprecate implicit loading of assemblies":
214+
// Set the fromFile flag if the name of the loaded assembly matches
215+
// the fully qualified name that was requested.
214216
//===================================================================
215217

216218
public static bool LoadImplicit(string name, out bool fromFile) {
@@ -225,19 +227,15 @@ public static bool LoadImplicit(string name, out bool fromFile) {
225227
if (!probed.ContainsKey(s)) {
226228
if (LoadAssemblyPath(s) != null){
227229
loaded = true;
228-
// 2010-08-16: Deprecation support
229-
if (s == name) {
230-
fromFile = true;
231-
}
232230
}
233231
else if (LoadAssembly(s) != null) {
234232
loaded = true;
235-
// 2010-08-16: Deprecation support
236-
if (s == name) {
237-
fromFile = true;
238-
}
239233
}
240234
probed[s] = 1;
235+
// 2010-12-24: Implicit Load Deprecation logic
236+
if (loaded && (s == name)) {
237+
fromFile = true;
238+
}
241239
}
242240
}
243241
return loaded;

0 commit comments

Comments
 (0)