c/python runs c++ code raises exception