擅长:python、mysql、java
<p><code>atexit.register()</code>基本上是在<code>atexit._exithandlers</code>中注册您的函数,这是<code>sys.exitfunc()</code>调用的函数的模块私有列表。您可以将<code>exitfunc()</code>设置为自定义的退出处理程序函数,然后检查子级状态或简单地注销它。将3.0<code>atexit.py</code>复制到本地源代码树并使用它呢?在</p>
<p>编辑:我复制了自动退出.py从我的2.6版本扩展到</p>
<pre><code>def unregister(func, *targs, **kargs):
_exithandlers.remove((func, targs, kargs))
</code></pre>
<p>如果你用它代替你原来的版本,它应该可以工作。不过,我还没有用子流程测试过它。在</p>