Open bnorick opened 3 years ago
As much I don't really want to encourage people using circular imports I believe you're correct in narrowing down the underlying issue and this seems like a sensible change, I'll happily accept a PR implementing this as long as there's a test provided (will require a test package with a circular import to replicate the situation).
I have an issue with circular imports that I am having trouble resolving.
Here is a simple repro case which is similar to what I am doing:
When I run this, I get an
AttributeError
related to circular imports caused by a call toget_type_hints
. I hoped this would defer, due to the use of a forward reference inc.py
and module imports, but maybe I am misunderstanding?Since I don't have a full understanding of
Injector
internals, I tried a longshot of addingAttributeError
to the try/except (in addition toNameError
that's already caught) in_infer_injected_bindings
at line 1164. This actually works for both the simplified repro and my actual application. However, I don't know what other implications this change might have and I wanted to seek you advice.Thanks!