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:

committed by
Sergey Shepelev

parent
68b5641f22
commit
7c21c8f92e
@@ -98,11 +98,14 @@ def waitpid(pid, options):
|
|||||||
__original_open__ = os_orig.open
|
__original_open__ = os_orig.open
|
||||||
|
|
||||||
|
|
||||||
def open(file, flags, mode=0o777):
|
def open(file, flags, mode=0o777, dir_fd=None):
|
||||||
""" Wrap os.open
|
""" Wrap os.open
|
||||||
This behaves identically, but collaborates with
|
This behaves identically, but collaborates with
|
||||||
the hub's notify_opened protocol.
|
the hub's notify_opened protocol.
|
||||||
"""
|
"""
|
||||||
|
if dir_fd is not None:
|
||||||
|
fd = __original_open__(file, flags, mode, dir_fd=dir_fd)
|
||||||
|
else:
|
||||||
fd = __original_open__(file, flags, mode)
|
fd = __original_open__(file, flags, mode)
|
||||||
hubs.notify_opened(fd)
|
hubs.notify_opened(fd)
|
||||||
return fd
|
return fd
|
||||||
|
Reference in New Issue
Block a user