New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Eventlet broke pathlib on Python 3.7 when patches os
#534
Comments
Here is my traceback:
|
fixed my issue by disabling eventlet patching os: |
Of course it doesn't appear if you don't patch os. However, sometimes you have no choice. For example, nameko patches os inside and you can't configure it. |
openstack-gerrit
pushed a commit
to openstack/requirements
that referenced
this issue
Aug 19, 2019
Commit [1] bumped the upper constraint for kombu to 4.6.4. Per issues [2][3] this interacts poorly with eventlet and breaks many things openstack on py37 (including nova gate - see the linked bug) with this error: TypeError: open: path should be string, bytes or os.PathLike, not _NormalAccessor I opened an issue against kombu [4]. It is possible there will be a simple way to fix those many things, but in the meantime, this commit blacklists 4.6.4 to get the world moving again. Thanks to Daniel Leaberry for doing the legwork to identify the problem [5]. Closes-Bug: #1840551 [1] Id71496bcb5c8342851f287e35931431e8a443d23 [2] eventlet/eventlet#534 [3] nameko/nameko#655 [4] celery/kombu#1082 [5] http://lists.openstack.org/pipermail/openstack-discuss/2019-August/008553.html Change-Id: I113c06f6e09727aa279f5ab8d2b7534a019394c2
openstack-gerrit
pushed a commit
to openstack/openstack
that referenced
this issue
Aug 19, 2019
* Update requirements from branch 'master' - Blacklist kombu-4.6.4 Commit [1] bumped the upper constraint for kombu to 4.6.4. Per issues [2][3] this interacts poorly with eventlet and breaks many things openstack on py37 (including nova gate - see the linked bug) with this error: TypeError: open: path should be string, bytes or os.PathLike, not _NormalAccessor I opened an issue against kombu [4]. It is possible there will be a simple way to fix those many things, but in the meantime, this commit blacklists 4.6.4 to get the world moving again. Thanks to Daniel Leaberry for doing the legwork to identify the problem [5]. Closes-Bug: #1840551 [1] Id71496bcb5c8342851f287e35931431e8a443d23 [2] eventlet/eventlet#534 [3] nameko/nameko#655 [4] celery/kombu#1082 [5] http://lists.openstack.org/pipermail/openstack-discuss/2019-August/008553.html Change-Id: I113c06f6e09727aa279f5ab8d2b7534a019394c2
davidszotten
added a commit
to davidszotten/eventlet
that referenced
this issue
Aug 19, 2019
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)
davidszotten
added a commit
to davidszotten/eventlet
that referenced
this issue
Aug 19, 2019
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)
jstasiak
pushed a commit
that referenced
this issue
Aug 20, 2019
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)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Script to reproduce:
As you can see,
Path.open
doesn't work on Python 3.7. It's becausepathlib
uses_NormalAccessor
instance, that stores functions fromos
as attributes:Python <3.7 wraps this functions in
staticmethod
like this:However Python 3.7 doesn't. Python doesn't bound
os.open
to_NormalAccessor
becauseos.open
isn't a function. But when eventlet patchesos.open
by the custom python function then interpreter bound this function (eventlet.green.os.open
) to_NormalAccessor
.I can't report this bug to Python because I can't register on bugs.python.org >.<
Possible solution: patch
_NormalAccessor
too. But don't forget: in Python 3.6 passed argument has to converted to string:References:
The text was updated successfully, but these errors were encountered: