A python script should not be able to make your Mac crash (depending on what you mean by "weird system crash"). If it actually causes a hard crash, that likely either points to a weird hardware/software problem on your system, or it's a bug that Apple would like to know about if they don't already.