执行geevent .monkey.patch_all()补丁文件对象



我注意到gevent支持类文件对象的包装器:http://www.gevent.org/gevent.fileobject.html

gevent.monkey.patch_all方便地对sockettime等模块进行补丁,使其对gevent友好。阅读代码,patch_all()似乎没有调用显式的patch_file(),但它确实调用了patch_builtins()。这个函数的实现有点神奇。我不清楚这是否会修补内置的file对象。

有人知道吗?

不,内置的file没有打补丁。您需要使用gevent FileObject

最新更新