Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-85275: Remove old buffer APIs#105137

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
methane merged 7 commits intopython:mainfrommethane:remove-old-buffer-protocol
Jun 2, 2023

Conversation

methane
Copy link
Member

@methanemethane commentedMay 31, 2023
edited by github-actionsbot
Loading

They are now ABI only.


📚 Documentation preview 📚:https://cpython-previews--105137.org.readthedocs.build/


* ``PyObject_AsCharBuffer()``, ``PyObject_AsReadBuffer()``, ``PyObject_CheckReadBuffer()``,
and ``PyObject_AsWriteBuffer()`` are removed. Please migrate to new buffer protocol;
:c:func:`PyObject_GetBuffer` and :c:func:`PyBuffer_Release`.
Copy link
Member

Choose a reason for hiding this comment

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

Would it be possible to elaborate how to replace the 3 "As" functions withPyObject_GetBuffer() flags? I'm not used this Py_buffer API. AsCharBuffer() useconst char ** type and AsReadBuffer() useconst void **buffer type: constant. ButPyBuffer.buf type isvoid*, it's mutable. Maybe add a note about casting if needed? Or provide a full recipe. I don't know.

How do you replacebuffer_len? Is itPy_buffer.len orPy_buffer.itemsize? It's a honest question, I don't know the answer :-(

You may also mention that PyObject_CheckReadBuffer() ignores any kind of exception, whereas PyObject_GetBuffer() can raise different exceptions. What is the expected exception if a type doesn't support the buffer protocol?

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

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

LGTM, thanks. Let's try again to remove them in Python 3.13.

Co-authored-by: Victor Stinner <vstinner@python.org>
@methanemethaneenabled auto-merge (squash)June 2, 2023 00:49
@methanemethane merged commit37498fc intopython:mainJun 2, 2023
@methanemethane deleted the remove-old-buffer-protocol branchJune 2, 2023 01:12
@vstinner
Copy link
Member

Nice. Let's see how it goes now :-)

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@vstinnervstinnervstinner approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@methane@vstinner@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp