[issue12797] io.FileIO and io.open should support openat
Ross Lagerwall
report at bugs.python.org
Sat Oct 29 20:33:51 CEST 2011
Ross Lagerwall <rosslagerwall at gmail.com> added the comment:
Before I implement it properly, is this the kind of api that's desired?
"""
import os
import io
class MyOpener:
def __init__(self, dirname):
self.dirfd = os.open(dirname, os.O_RDONLY)
def open(self, path, flags, mode):
return os.openat(self.dirfd, path, flags, mode)
myop = MyOpener("/tmp")
f = open("testfile", "w", opener=myop.open)
f.write("hello")
"""
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12797>
_______________________________________
More information about the Python-bugs-list
mailing list