Skip to content

Fix types in buffer/memoryview docs - #98118

Merged
JelleZijlstra merged 1 commit into
python:mainfrom
da-woods:buffer-docs-fix
Oct 10, 2022
Merged

JelleZijlstra merged 1 commit into
python:mainfrom
da-woods:buffer-docs-fix

Conversation

@da-woods

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

Copy link
Copy Markdown
Contributor

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

da-woods commented Oct 9, 2022

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
Member

Thanks for noticing this!

@JelleZijlstra
JelleZijlstra merged commit c459fed into python:main Oct 10, 2022
@miss-islington

Copy link
Copy Markdown
Contributor

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 bedevere-bot removed the needs backport to 3.11 only security fixes label Oct 10, 2022
@bedevere-bot

Copy link
Copy Markdown

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
Copy Markdown

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 October 10, 2022 05:43
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.

5 participants