scipy / weave

Weave - tools for including C/C++ code within Python code.
https://pypi.org/project/scipy-weave/
Other
55 stars 27 forks source link

weave.inline() in import hangs python2 runtime #16

Closed adriaanph closed 3 years ago

adriaanph commented 3 years ago

symptoms: the behaviour only manifests when weave.inline() is executed and compiles the code within a python "import" statement: then the python runtime either "hangs" or from jupyter notebooks the "kernel dies". however, if the same code is wrapped in a function and the function is called outside of an import statement, then this doesn't happen.

reproduction:

`import weave` `def demo():` ` a = 'string'` ` weave.inline(r'printf("%s\n",std::string(a).c_str());',['a'], verbose=2)` ` ` `demo() # Called on import` now from `__main__` script: `import weavetest # This may kill the python runtime if using numpy > 1.14.6` **platform config:** python 2.7.17 weave 0.17.0 ubuntu 4.15.0-130 **suggestions:** while this should probably be corrected within the numpy package, it could also be addressed by forcing weave's dependency for numpy<=1.14.6. since the python 2 platform now has "end-of-life" status it may be that the latter solution is most appropriate?
rgommers commented 3 years ago

since the python 2 platform now has "end-of-life" status it may be that the latter solution is most appropriate?

Yes indeed. That's what you should do in the dependencies of your project.

I don't think we'll do another weave release with this, because that could break other people who successfully use it with numpy > 1.14.6

adriaanph commented 3 years ago

thanks for the feedback.