8000 Try to detect whether the clr module is partially initialised · quantfns/pythonnet@588ef6c · GitHub
[go: up one dir, main page]

Skip to content

Commit 588ef6c

Browse files
committed
Try to detect whether the clr module is partially initialised
This should fix issue pythonnet#1582. While the respective behaviour (setting the member value `_initializing`) is not documented, it has been that way since at least 3.4. As we control `clr`, it can also not happen, that the value is accidentally set.
1 parent 55abd29 commit 588ef6c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/runtime/importhook.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ def find_spec(klass, fullname, paths=None, target=None):
4444
if 'clr' not in sys.modules:
4545
return None
4646
clr = sys.modules['clr']
47+
if getattr(clr, '_initializing', False):
48+
return None
4749
4850
clr._add_pending_namespaces()
4951

0 commit comments

Comments
 (0)
0