Skip to content
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

workaround for pathlib on py 3.7 #584

Merged
merged 1 commit into from
Aug 20, 2019

Conversation

davidszotten
Copy link
Contributor

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)

fixes #534

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)
@codecov-io
Copy link

Codecov Report

Merging #584 into master will decrease coverage by <1%.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #584   +/-   ##
=====================================
- Coverage      46%    46%   -1%     
=====================================
  Files          81     81           
  Lines        7976   7978    +2     
  Branches     1365   1366    +1     
=====================================
- Hits         3728   3701   -27     
- Misses       3995   4019   +24     
- Partials      253    258    +5
Flag Coverage Δ
#ipv6 15% <0%> (-1%) ⬇️
#py27epolls 49% <0%> (-1%) ⬇️
#py27poll 49% <0%> (-1%) ⬇️
#py27selects 49% <0%> (-1%) ⬇️
#py34epolls 42% <0%> (ø) ⬆️
#py34poll 42% <0%> (ø) ⬆️
#py34selects 42% <0%> (?)
#py35epolls 42% <0%> (ø) ⬆️
#py35poll 42% <0%> (ø) ⬆️
#py35selects 42% <0%> (ø) ⬆️
#py36epolls 42% <0%> (ø) ⬆️
#py36poll 42% <0%> (ø) ⬆️
#py36selects 42% <0%> (ø) ⬆️
#py37epolls 42% <50%> (ø) ⬆️
#py37poll 42% <50%> (ø) ⬆️
#py37selects 42% <50%> (ø) ⬆️
Impacted Files Coverage Δ
eventlet/green/os.py 38% <100%> (+6%) ⬆️
eventlet/db_pool.py 72% <0%> (-11%) ⬇️
eventlet/greenio/base.py 87% <0%> (-3%) ⬇️
eventlet/tpool.py 75% <0%> (-1%) ⬇️
eventlet/hubs/hub.py 91% <0%> (-1%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7f8d478...67ebfdd. Read the comment docs.

Copy link
Contributor

@jstasiak jstasiak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jstasiak jstasiak merged commit ca8dd07 into eventlet:master Aug 20, 2019
@orsinium
Copy link

Thank you for your work! Smart solution.

@davidszotten
Copy link
Contributor Author

Thanks @jstasiak . Any chance of a point version release with this fix to unblock kombu? Anything I can do to help with that?

@jstasiak
Copy link
Contributor

If you could prepare something like #572 for version 0.25.1 I can merge and release this within an hour.

@davidszotten
Copy link
Contributor Author

davidszotten commented Aug 21, 2019

sure, raised #585

@jstasiak
Copy link
Contributor

Done, just released now.

@davidszotten
Copy link
Contributor Author

Thanks!

mattbennett added a commit to mattbennett/nameko that referenced this pull request Oct 11, 2021
mattbennett added a commit to mattbennett/nameko that referenced this pull request Oct 11, 2021
mattbennett added a commit to nameko/nameko that referenced this pull request Oct 13, 2021
* remove automatic monkey-patching

(resolves #703)

* warns users if the monkeypatch is not applied
* suggests using pytest-eventlet as an alternative

* static

* add nameko test command

+ update warning
+ move nameko run patch into cli so it is earlier and more explicit

* add __main__ entrypoint so CI can run nameko test

* always continue on error for debug

* 0.25.1 is oldest supported eventlet on py37+

we need eventlet/eventlet#584

* Revert "always continue on error for debug"

This reverts commit e6fc162.

* don't need pytest-eventlet plugin anymore
mattbennett added a commit to nameko/nameko that referenced this pull request Oct 13, 2021
* remove automatic monkey-patching

(resolves #703)

* warns users if the monkeypatch is not applied
* suggests using pytest-eventlet as an alternative

# Conflicts:
#	nameko/testing/pytest.py

* static

* add nameko test command

+ update warning
+ move nameko run patch into cli so it is earlier and more explicit

* add __main__ entrypoint so CI can run nameko test

* 0.25.1 is oldest supported eventlet on py37+

we need eventlet/eventlet#584

* don't need pytest-eventlet plugin anymore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Eventlet broke pathlib on Python 3.7 when patches os
5 participants