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

Open not correctly patched with Python 3.12 #836

Closed
mrbean-bremen opened this issue May 29, 2023 · 2 comments · Fixed by #893
Closed

Open not correctly patched with Python 3.12 #836

mrbean-bremen opened this issue May 29, 2023 · 2 comments · Fixed by #893
Labels

Comments

@mrbean-bremen
Copy link
Member

mrbean-bremen commented May 29, 2023

After the beta release, something in the Python code had changed that prevents patching open as before.
As before open is still an alias to io.open (or vice verse), but patching io does no longer patch open.

I tried to patch builtins as had been done in Python2, but that does only work if directly importing open from builtins.
As a temporary workaround, I'm now patching open directly, which breaks skip modules for open, and importing open or io.open using another name (e.g. import open as _open). There are 4 respective tests that are currently disabled for Python 3.12.

I could not find the relevant change in the Python code yet. Have to check again once beta 2 is released, just in case this change is reverted (though I doubt that).

Edit: still true for Python 3.12.0.

@mrbean-bremen mrbean-bremen changed the title Open not correctly patched with Python3.12 beta1 Open not correctly patched with Python 3.12 beta1 May 29, 2023
@buhtz
Copy link

buhtz commented May 30, 2023

Can you confirm the concrete Python version please.
Myself I experienced problems with Python 3.12alpha (offered by TravisCI). But Python 3.12.0b1+ works fine.

@mrbean-bremen
Copy link
Member Author

I had previously added support for Python 3.12 alpha 6, which worked fine (the changes were mainly related to pathlib). The current problems came with the beta 1 versión, as mentioned.

@mrbean-bremen mrbean-bremen changed the title Open not correctly patched with Python 3.12 beta1 Open not correctly patched with Python 3.12 Oct 8, 2023
mrbean-bremen added a commit to mrbean-bremen/pyfakefs that referenced this issue Oct 8, 2023
- add patching _io, as this is used for io
- add workaround for calling the real open_code
  (does not work yet under Windows)
- add Python 3.12 to supported Python versions
- fixes pytest-dev#836
mrbean-bremen added a commit that referenced this issue Oct 9, 2023
- add patching _io, as this is used for io
- add workaround for calling the real open_code
  (does not work yet under Windows)
- add Python 3.12 to supported Python versions
- fixes #836
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants