Open whirm opened 8 years ago
As discussed in that issue, there's basically no way this is an issue with ImportMagic itself. All it does is import modules. My guess is that one of the C modules is triggering this by corrupting memory somewhere, and that manifests when importing libtorrent. The issue may or may not be with libtorrent itself.
It does suck though, no denying that. I'd be fine with a black-list feature for working around problems like this.
A blacklist would still work around that. Another possibility would be indexing C modules in a subprocess; this would avoid both crashing completely, and introducing incompatibilities between multiple C modules, which can cause such crashes in the first place.
Importing modules in separate interpreters is necessary in other cases as well, e.g. you can't import both PyQt4
and PyQt5
- no crash in this case, but a RuntimeError.
Yeah I agree re. blacklist (my last sentence stated that). Indexing in a subprocess isn't a bad idea either, maybe that's a better option.
Yeah I agree re. blacklist (my last sentence stated that).
Sorry, I overlooked that.
Having several subprocesses indexing modules in parallel would also speed up the process. I guess it would also set the base for index caching as a serialization system would be needed to transfer the collected data back from the subprocesses.
Some info from the debugger:
Note that running
module = __import__('libtorrent', fromlist=['.'])
from ipython works just fine.(I originally created the issue at https://github.com/jorgenschaefer/elpy/issues/834)
Let me know if you need any more info.
If you don't think that can be fixed on the importmagic side, would you accept a PR that adds a module blacklisting feature?
Thanks!