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

Fix types in buffer/memoryview docs #98118

Merged
merged 1 commit into from Oct 10, 2022

Conversation

da-woods
Copy link
Contributor

@da-woods da-woods commented Oct 9, 2022

The definition of obj in the Py_buffer struct is as a PyObject*

PyObject *obj; /* owned reference */

PyMemoryView_GET_BASE returns .obj - thus its return type should be a PyObject* (or at least a void*). It definitely doesn't return Py_buffer

The definition of obj in the `Py_buffer` struct is as a PyObject*
https://github.com/python/cpython/blob/ec091bd47e2f968b0d1631b9a8104283a7beeb1b/Include/pybuffer.h#L22

PyMemoryView_GET_BASE returns `.obj` - thus its return type
should be a PyObject* (or at least a void*). It definitely
doesn't return `Py_buffer`
@bedevere-bot bedevere-bot added awaiting review docs Documentation in the Doc dir skip news labels Oct 9, 2022
@da-woods
Copy link
Contributor Author

da-woods commented Oct 9, 2022

My view is that this is trivial enough not to need an issue, but I can create one if I'm wrong

@JelleZijlstra
Copy link
Member

JelleZijlstra commented Oct 10, 2022

Thanks for noticing this!

@JelleZijlstra JelleZijlstra merged commit c459fed into python:main Oct 10, 2022
14 checks passed
@miss-islington
Copy link
Contributor

miss-islington commented Oct 10, 2022

Thanks @da-woods for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11.
🐍🍒🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 10, 2022
The definition of obj in the `Py_buffer` struct is as a PyObject*
https://github.com/python/cpython/blob/ec091bd47e2f968b0d1631b9a8104283a7beeb1b/Include/pybuffer.hGH-L22

PyMemoryView_GET_BASE returns `.obj` - thus its return type
should be a PyObject* (or at least a void*). It definitely
doesn't return `Py_buffer`
(cherry picked from commit c459fed)

Co-authored-by: da-woods <dw-git@d-woods.co.uk>
@bedevere-bot
Copy link

bedevere-bot commented Oct 10, 2022

GH-98133 is a backport of this pull request to the 3.11 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 10, 2022
The definition of obj in the `Py_buffer` struct is as a PyObject*
https://github.com/python/cpython/blob/ec091bd47e2f968b0d1631b9a8104283a7beeb1b/Include/pybuffer.hGH-L22

PyMemoryView_GET_BASE returns `.obj` - thus its return type
should be a PyObject* (or at least a void*). It definitely
doesn't return `Py_buffer`
(cherry picked from commit c459fed)

Co-authored-by: da-woods <dw-git@d-woods.co.uk>
@bedevere-bot
Copy link

bedevere-bot commented Oct 10, 2022

GH-98134 is a backport of this pull request to the 3.10 branch.

miss-islington added a commit that referenced this pull request Oct 10, 2022
The definition of obj in the `Py_buffer` struct is as a PyObject*
https://github.com/python/cpython/blob/ec091bd47e2f968b0d1631b9a8104283a7beeb1b/Include/pybuffer.hGH-L22

PyMemoryView_GET_BASE returns `.obj` - thus its return type
should be a PyObject* (or at least a void*). It definitely
doesn't return `Py_buffer`
(cherry picked from commit c459fed)

Co-authored-by: da-woods <dw-git@d-woods.co.uk>
miss-islington added a commit that referenced this pull request Oct 10, 2022
The definition of obj in the `Py_buffer` struct is as a PyObject*
https://github.com/python/cpython/blob/ec091bd47e2f968b0d1631b9a8104283a7beeb1b/Include/pybuffer.hGH-L22

PyMemoryView_GET_BASE returns `.obj` - thus its return type
should be a PyObject* (or at least a void*). It definitely
doesn't return `Py_buffer`
(cherry picked from commit c459fed)

Co-authored-by: da-woods <dw-git@d-woods.co.uk>
@da-woods da-woods deleted the buffer-docs-fix branch Oct 10, 2022
mpage pushed a commit to mpage/cpython that referenced this pull request Oct 11, 2022
The definition of obj in the `Py_buffer` struct is as a PyObject*
https://github.com/python/cpython/blob/ec091bd47e2f968b0d1631b9a8104283a7beeb1b/Include/pybuffer.h#L22

PyMemoryView_GET_BASE returns `.obj` - thus its return type
should be a PyObject* (or at least a void*). It definitely
doesn't return `Py_buffer`
pablogsal pushed a commit that referenced this pull request Oct 22, 2022
The definition of obj in the `Py_buffer` struct is as a PyObject*
https://github.com/python/cpython/blob/ec091bd47e2f968b0d1631b9a8104283a7beeb1b/Include/pybuffer.hGH-L22

PyMemoryView_GET_BASE returns `.obj` - thus its return type
should be a PyObject* (or at least a void*). It definitely
doesn't return `Py_buffer`
(cherry picked from commit c459fed)

Co-authored-by: da-woods <dw-git@d-woods.co.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip issue skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants