8000 Alternative Fix for #182 (#231) · pythonnet/pythonnet@26f1438 · GitHub
[go: up one dir, main page]

Skip to content

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

Appearance settings

Commit 26f1438

Browse files
authored
Alternative Fix for #182 (#231)
1 parent 7fcf401 commit 26f1438

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
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