diff options
| author | David Szotten <davidszotten@gmail.com> | 2019-08-19 21:14:50 +0100 |
|---|---|---|
| committer | Jakub Stasiak <jakub@stasiak.at> | 2019-08-20 10:13:58 +0200 |
| commit | ca8dd0748a1985a409e9a9a517690f46e05cae99 (patch) | |
| tree | b47cd9136a6d8729a971e7ee9a64d8e73172e001 /tests | |
| parent | 7f8d478686532c314ad013840aa6388ec190f736 (diff) | |
| download | eventlet-ca8dd0748a1985a409e9a9a517690f46e05cae99.tar.gz | |
workaround for pathlib on py 3.7
fixes #534
pathlib._NormalAccessor wraps `open` in `staticmethod` for py < 3.7 but
not 3.7. That means we `Path.open` calls `green.os.open` with `file`
being a pathlib._NormalAccessor object, and the other arguments shifted.
Fortunately pathlib doesn't use the `dir_fd` argument, so we have space
in the parameter list. We use some heuristics to detect this and adjust
the parameters (without importing pathlib)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/os_test.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/os_test.py b/tests/os_test.py new file mode 100644 index 0000000..3688d19 --- /dev/null +++ b/tests/os_test.py @@ -0,0 +1,11 @@ +import eventlet +import six + + +if six.PY3: + def test_pathlib_open_issue_534(): + pathlib = eventlet.import_patched('pathlib') + path = pathlib.Path(__file__) + with path.open(): + # should not raise + pass |
