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-98410: move getbufferproc and releasebufferproc to buffer.h by davidhewitt · Pull Request #31158 · python/cpython

Conversation

@davidhewitt

@davidhewitt davidhewitt commented Feb 6, 2022 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

After #29991 it is possible to set Py_bf_getbuffer and Py_bf_releasebuffer slots from the stable API.

This PR moves the corresponding typedefs for the function pointer types corresponding to these slots from Include/cpython/object.h to be alongside other typedefs in Include/pybuffer.h.

This may be useful for users who wish to cast to these function pointer types.

  • Issue: Please add getbufferproc and releasebufferproc to the limited API headers #98410

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-bot bedevere-bot added the awaiting review label Feb 6, 2022
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Feb 6, 2022
@davidhewitt
davidhewitt force-pushed the buffer-procs branch from 17e73b3 to 7c6bb60 Compare February 6, 2022 12:22
@ezio-melotti ezio-melotti removed the CLA signed label Jul 13, 2022
@kumaraditya303

kumaraditya303 commented Oct 10, 2022 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Closing as the buffer protocol is available in 3.11 in Limited C API.

All reactions

Sorry, something went wrong.

Uh oh!

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

@kumaraditya303 kumaraditya303 closed this Oct 10, 2022
@davidhewitt

davidhewitt commented Oct 12, 2022 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor Author

@kumaraditya303 can I please push for you to consider reopening and reviewing this patch? The point that the buffer protocol is available in 3.11 is exactly why I think this should be merged.

As of current 3.11 release on the limited API I can call PyType_GetSlot(Py_TYPE(obj), Py_bf_getbuffer) to get a void * for the getbuffer slot but I can't cast this to a getbufferproc because the definition exists only on the unlimited API. This patch makes getbufferproc available on the limited API.

(And equivalent for releasebufferproc)

All reactions

Sorry, something went wrong.

Uh oh!

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

@kumaraditya303 kumaraditya303 reopened this Oct 12, 2022
@kumaraditya303

kumaraditya303 commented Oct 12, 2022

Copy link
Copy Markdown
Contributor

@davidhewitt Sorry for closing your PR. I reopened it and you are correct that the function typedefs are not exposed. I would suggest you to create issue for this issue to discuss this first, nobody looked at this because no issue was mentioned and there are conflicts and and this can't be fixed in 3.11 as the rc is out and final is about to be released.

There are conflicts in this PR, I would suggest you create a new PR with fixed conflicts but it's your choice if you want to continue with this one.

All reactions

Sorry, something went wrong.

Uh oh!

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

@davidhewitt davidhewitt mentioned this pull request Oct 18, 2022
Please add getbufferproc and releasebufferproc to the limited API headers #98410
Closed
@davidhewitt davidhewitt changed the title move getbufferproc and releasebufferproc to object.h gh-98410: move getbufferproc and releasebufferproc to object.h Oct 18, 2022
@davidhewitt

davidhewitt commented Oct 18, 2022

Copy link
Copy Markdown
Contributor Author

@kumaraditya303 thanks very much - I have opened #98410 and I'm happy to spend the time to rebase this PR once someone has suggested that a change of this nature would potentially be suitable to merge.

All reactions

Sorry, something went wrong.

Uh oh!

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

@encukou

encukou commented Oct 24, 2022

Copy link
Copy Markdown
Member

Thanks for the catch!
Definitely suitable for merge. It won't make it to Python 3.11.0 (sorry!), but it can go in 3.12. (And possibly in 3.11.1, since it's only affecting API rather than ABI.)
Please move the definitions to Include/buffer.h, together with the other buffer API. That way you shouldn't need the forward definition.
Please add these to Misc/stable_abi.toml, as typedef entries added in 3.12, and re-run make regen-limited-abi.

Let me know if you want more info, or if you'd prefer to leave this to me.

All reactions

Sorry, something went wrong.

Uh oh!

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

@davidhewitt

davidhewitt commented Oct 25, 2022

Copy link
Copy Markdown
Contributor Author

Thanks - I'll do my best to find a moment to tidy this up tonight!

All reactions

Sorry, something went wrong.

Uh oh!

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

@davidhewitt
davidhewitt force-pushed the buffer-procs branch from 7c6bb60 to a11ce47 Compare October 25, 2022 17:49
@davidhewitt davidhewitt changed the title gh-98410: move getbufferproc and releasebufferproc to object.h gh-98410: move getbufferproc and releasebufferproc to buffer.h Oct 25, 2022
@davidhewitt

davidhewitt commented Oct 25, 2022

Copy link
Copy Markdown
Contributor Author

@encukou how does that look?

All reactions

Sorry, something went wrong.

Uh oh!

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

@davidhewitt
davidhewitt force-pushed the buffer-procs branch from 75b0e16 to eae6de2 Compare October 27, 2022 06:36
@davidhewitt
move getbufferproc and releasebufferproc to pybuffer.h
a768db1
@davidhewitt
davidhewitt force-pushed the buffer-procs branch from eae6de2 to a768db1 Compare October 28, 2022 19:57
@davidhewitt

davidhewitt commented Oct 28, 2022

Copy link
Copy Markdown
Contributor Author

rebased

All reactions

Sorry, something went wrong.

Uh oh!

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

@encukou

encukou commented Oct 31, 2022

Copy link
Copy Markdown
Member

Looks good, thank you!
The rules say these should be available for 3.12+ only, i.e. guarded with:

#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030c0000

but with typedefs, we can relax this rule a little: they'll be available to people building for 3.11 using 3.12.

All reactions

Sorry, something went wrong.

Uh oh!

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

@encukou
encukou merged commit e98923c into python:main Oct 31, 2022
@bedevere-bot bedevere-bot removed the awaiting review label Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

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

Assignees

No one assigned

Labels

None yet

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.

6 participants

@davidhewitt @kumaraditya303 @encukou @the-knights-who-say-ni @ezio-melotti @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.