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

Do not use CFFI access by default on PyPy #7236

Merged
merged 4 commits into from Jun 29, 2023

Conversation

radarhere
Copy link
Member

@radarhere radarhere commented Jun 28, 2023

Resolves #7223

Pillow's C API is now faster than PyAccess on PyPy. However, PyAccess is part of our public API, so it can't be removed immediately.

This PR makes two changes.

  1. Image.USE_CFFI_ACCESS is set to False, even on PyPy, allowing the faster C API to be used by default. If users do set Image.USE_CFFI_ACCESS to True manually, then they will find that...
  2. PyAccess is now deprecated, to be removed in Pillow 11.

@radarhere radarhere added Performance Deprecation Feature that will be removed in the future labels Jun 28, 2023
@radarhere radarhere mentioned this pull request Jun 28, 2023

Since Pillow's C API is now faster than PyAccess on PyPy,
:py:mod:`~PIL.PyAccess` has been deprecated and will be removed in Pillow
11.0.0 (2024-10-15).
Copy link
Member

Choose a reason for hiding this comment

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

And mention the C API is now used by default?

(And in docs/releasenotes/10.0.0.rst)

@radarhere
Copy link
Member Author

I've updated the documentation to similarly deprecate Image.USE_CFFI_ACCESS.

Unfortunately, from https://discuss.python.org/t/extend-pep-562-with-setattr-for-modules/25506 it looks like it is not possible to override __setattr__ on a module, so we can't raise a deprecation warning if users call Image.USE_CFFI_ACCESS = True.

@hugovk hugovk added this to the 10.0.0 milestone Jun 29, 2023
@hugovk hugovk merged commit 2de1bf2 into python-pillow:main Jun 29, 2023
54 checks passed
@radarhere radarhere deleted the pyaccess branch June 29, 2023 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecation Feature that will be removed in the future Performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Is CFFI still needed?
2 participants