8000 Alternative Fix for #182 · pythonnet/pythonnet@91818ef · GitHub
[go: up one dir, main page]

Skip to content

Commit 91818ef

Browse files
matthidtonyroberts
authored andcommitted
Alternative Fix for #182
1 parent 72366c6 commit 91818ef

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/runtime/importhook.cs

Lines changed: 9 additions & 0 deletions
8436
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,15 @@ public static IntPtr __import__(IntPtr self, IntPtr args, IntPtr kw)
246246
// and it was NOT an ImportError; bail out here.
247247
return IntPtr.Zero;
248248
}
249+
250+
if (mod_name == string.Empty)
251+
{
252+
// Most likely a missing relative import.
253+
// For example site-packages\bs4\builder\__init__.py uses it to check if a package exists:
254+
// from . import _html5lib
255+
// We don't support them anyway
256+
return IntPtr.Zero;
257+
}
249258
// Otherwise, just clear the it.
250259
Exceptions.Clear();
251260
}

0 commit comments

Comments
 (0)
0