GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-85275: Remove old buffer APIs by methane · Pull Request #105137 · python/cpython

Conversation

@methane

@methane methane commented May 31, 2023 •
edited by github-actions Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

They are now ABI only.

  • Issue: Removing old buffer support #85275

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@methane
Remove old buffer APIs
620eb05
@methane methane added the topic-C-API label May 31, 2023
@bedevere-bot bedevere-bot mentioned this pull request May 31, 2023
Removing old buffer support #85275
Closed
methane added 2 commits May 31, 2023 20:16
@methane
regenerate stable_abi.dat
7f6cf8d
@methane
Merge branch 'main' into remove-old-buffer-protocol
3a881bf
@methane
methane marked this pull request as ready for review May 31, 2023 12:28
@bedevere-bot bedevere-bot added the awaiting core review label May 31, 2023
@methane methane mentioned this pull request Jun 1, 2023
C API: Remove legacy buffer API like PyObject_AsReadBuffer() #105186
Closed
vstinner
vstinner reviewed Jun 1, 2023
View reviewed changes
Comment thread Doc/whatsnew/3.13.rst Outdated

* ``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`.

@vstinner vstinner Jun 1, 2023

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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 with PyObject_GetBuffer() flags? I'm not used this Py_buffer API. AsCharBuffer() use const char ** type and AsReadBuffer() use const void **buffer type: constant. But PyBuffer.buf type is void*, it's mutable. Maybe add a note about casting if needed? Or provide a full recipe. I don't know.

How do you replace buffer_len? Is it Py_buffer.len or Py_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?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
methane added 3 commits June 2, 2023 00:40
@methane
Merge remote-tracking branch 'upstream/main' into remove-old-buffer-p…
9d34574
…rotocol
@methane
Add example code to what's new.
a1cdc85
@methane
Reduce example.
cc30889
vstinner
vstinner approved these changes Jun 1, 2023
View reviewed changes

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this 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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Doc/whatsnew/3.13.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels Jun 1, 2023
@methane @vstinner
Update Doc/whatsnew/3.13.rst
a74e0a1
Co-authored-by: Victor Stinner <[email protected]>
@methane
methane enabled auto-merge (squash) June 2, 2023 00:49
@methane
methane merged commit 37498fc into python:main Jun 2, 2023
@methane
methane deleted the remove-old-buffer-protocol branch June 2, 2023 01:12
@bedevere-bot bedevere-bot removed the awaiting merge label Jun 2, 2023
@vstinner

vstinner commented Jun 3, 2023

Copy link
Copy Markdown
Member

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jyknight jyknight mentioned this pull request Nov 13, 2025
Make LLDB compatible with the Python Limited C API llvm/llvm-project#151617
Closed
19 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vstinner vstinner vstinner approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

topic-C-API

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@methane @vstinner @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.