Fix monkey-patched os.open(): add dir_fd parameter

The os.open() function got a new option keyword-only dir_fd parameter in
Python 3.3:
https://docs.python.org/3/library/os.html#os.open

With this change, the open() now accepts the dir_fd parameter.
This commit is contained in:
Victor Stinner
2014-11-27 15:05:55 +01:00
committed by Sergey Shepelev
parent 68b5641f22
commit 7c21c8f92e

View File

@@ -98,11 +98,14 @@ def waitpid(pid, options):
__original_open__ = os_orig.open
def open(file, flags, mode=0o777):
def open(file, flags, mode=0o777, dir_fd=None):
""" Wrap os.open
This behaves identically, but collaborates with
the hub's notify_opened protocol.
"""
fd = __original_open__(file, flags, mode)
if dir_fd is not None:
fd = __original_open__(file, flags, mode, dir_fd=dir_fd)
else:
fd = __original_open__(file, flags, mode)
hubs.notify_opened(fd)
return fd