I have a problem to run ndarray.dot(array-like object) either in Python 2.7 and 3.4 in exec() function - python hangs and I need to close it. Based on Numpy "dot" hangs or multiprocessing with numpy quits Python it is a known issue. When multiprocessing library is used, python hangs because of the deadlock.
How the code below behaves using exec()? Does exec() create a new thread? Is there any solution to fix it?
The actual code is more complex, so I need to use exec().
test_dot.py:
test_global_env = {
'__builtins__': None,
'np': numpy
}
test_local_env = {}
test = '''
result = np.array([[1, 2], [3, 4]]).dot([0.14, 0.1])
'''
if __name__ == '__main__':
exec(test, test_global_env, test_local_env)
Thank you.