From 7c21c8f92eed58c508f30defed133071c5728df7 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 27 Nov 2014 15:05:55 +0100 Subject: [PATCH] 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. --- eventlet/green/os.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/eventlet/green/os.py b/eventlet/green/os.py index 19bb7ad..959d15f 100644 --- a/eventlet/green/os.py +++ b/eventlet/green/os.py @@ -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