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

Always close the wheel tempfile after writing to it #122

Merged
merged 2 commits into from Jan 29, 2021

Conversation

kurtmckee
Copy link
Contributor

@kurtmckee kurtmckee commented Jan 7, 2021

Resolves: python-poetry/poetry#3545

  • Added tests for changed code.
  • Updated documentation for changed code.

As mentioned in python-poetry/poetry#3545, PyPy3 on Windows does not auto-close the tempfile that is created when building wheels. It appears that CPython auto-closes the file as the zip file context manager exits, but PyPy3 does not, leading to a PermissionError.

There are two commits in this patch:

  1. The first demonstrates the issue. In fact, by maintaining a reference to the file object, it stays open in CPython and generates the exact same PermissionError as in PyPy3.
  2. The second closes the issue by moving the bare os.fdopen() call into a context manager.

Please let me know if there is anything else that needs to be done, or if you want something accomplished in a different way. Resolving this issue will allow me to run feedparser unit tests on Windows with PyPy3.

@kurtmckee
Copy link
Contributor Author

It looks like there are linting tests that are failing. I'll get this fixed immediately.

Could the linters be run with tox as well? This would let me resolve quality problems prior to pushing. 😄

@sdispater sdispater merged commit 4db39a6 into python-poetry:master Jan 29, 2021
@sdispater sdispater mentioned this pull request Feb 5, 2021
@kurtmckee kurtmckee deleted the fix-poetry-3545 branch April 1, 2022 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants