forked from eventlet/eventlet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes eventlet#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)
- Loading branch information
1 parent
7f8d478
commit 124c7eb
Showing
2 changed files
with
18 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import eventlet | ||
pathlib = eventlet.import_patched('pathlib') | ||
|
||
|
||
def test_pathlib_open_issue_534(): | ||
path = pathlib.Path(__file__) | ||
with path.open(): | ||
# should not raise | ||
pass |