Skip to content

Comments

Always close the wheel tempfile after writing to it#122

Merged
sdispater merged 2 commits intopython-poetry:masterfrom
kurtmckee:fix-poetry-3545
Jan 29, 2021
Merged

Always close the wheel tempfile after writing to it#122
sdispater merged 2 commits intopython-poetry:masterfrom
kurtmckee:fix-poetry-3545

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

Development

Successfully merging this pull request may close these issues.

Windows PyPy3 wheel builds crash due to unclosed file

2 participants