解决python Process finished with exit code -1073741571 (0xC00000FD)问题

python跑代码的时候碰到Process finished with exit code -1073741571 (0xC00000FD)报错,网上搜了发现可能原因如下:
1. pycharm的内容空间不够。
解决方案:
(1)Help->Find Action->搜VM->
(2)修改-Xmx750m 成-Xmx3072m或其他,不要超过电脑内存,保存重启pycharm生效。
参考链接:https://blog.youkuaiyun.com/qq_31293215/article/details/88350910

2.递归导致的栈溢出
**解决方案:**尾递归优化。
修改前:


def tree_to_token_index(root_node):
    if (len(root_node.children) == 0 or root_node.type == 'string') and root_node.type != 'comment':
        return [(root_node.start_point, root_node.end_point)]
    else:
        code_tokens = []
        for child in root_node.children:
            code_tokens += tree_to_token_index(child)
        return code_tokens

修改方法:return 改为yeild,然后后面加上尾递归改造的函数

def tree_to_token_index(root_node):
    if (len(root_node.children) == 0 or root_node.type == 'string') and root_node.type != 'comment':
        yield  [(root_node.start_point, root_node.end_point)]
    else:
        code_tokens = []
        for child in root_node.children:
            code_tokens += tree_to_token_index(child)
        yield code_tokens

def tramp(gen, arg):
    g = gen(arg)
    return g

# 代码调用
tramp(tree_to_token_index,root_node)

参考链接: https://blog.youkuaiyun.com/ztf312/article/details/81296772

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

今天不熬夜!

你的鼓励将是我创作的最大动力~

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值