Skip to content

C API: Remove legacy buffer API like PyObject_AsReadBuffer() #105186

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

Closed
vstinner opened this issue Jun 1, 2023 · 3 comments
Closed

C API: Remove legacy buffer API like PyObject_AsReadBuffer() #105186

vstinner opened this issue Jun 1, 2023 · 3 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@vstinner
Copy link
Member

vstinner commented Jun 1, 2023

Would it be ok to remove the legacy "buffer" API in Python 3.13, scheduled for October 2024? I'm talking about functions:

  • PyObject_AsCharBuffer()
  • PyObject_CheckReadBuffer()
  • PyObject_AsReadBuffer()
  • PyObject_AsWriteBuffer()

This API is deprecated since Python 3.0 and is older than the new Py_buffer API. The Py_buffer API is safer: it has a PyBuffer_Release() method to notify when the consumer is done: the resource can be released. The Py_buffer API is now commonly used.

In June 2020, there was a first attempt to remove these functions in issue #85275: commit 6f8a6ee. It caused too many troubles and had to be reverted the following year (commit ce5e1a6, July 2021). The removed functions were still used by at least 6 projects:

The webassets project was also mentioned, but I'm not sure that its failure is related to these removal: see https://bugzilla.redhat.com/show_bug.cgi?id=1899555 I cannot find these functions in https://github.com/Kronuz/pyScss code right now.

Sadly, the 4 functions are part of the stable ABI and have to be kept there. I'm only asking to remove them in the C API. The issue #88775 was complaining that the functions were removed wheareas they are part of the stable ABI.

@vstinner vstinner added the type-bug An unexpected behavior, bug, or error label Jun 1, 2023
@vstinner
Copy link
Member Author

vstinner commented Jun 1, 2023

@methane: Would do you think? If you think that it's now ok, I can work on a PR to remove them (but keep them in the stable ABI).

@methane
Copy link
Member

methane commented Jun 1, 2023

See
#105137

@vstinner
Copy link
Member Author

vstinner commented Jun 1, 2023

Oh nice, let's discussion the discussion in issue #85275 (and PR #105137).

@vstinner vstinner closed this as completed Jun 1, 2023
chris-allan added a commit to chris-allan/zeroc-ice-py-patches that referenced this issue Feb 26, 2025
This patch is similar to the changes from zeroc-ice/ice#2910 but
also includes backports of portions of zeroc-ice/ice#271.

Upstream Python 3.13 references are:

* python/cpython#105107
* python/cpython#105186
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants