Visitar URL original
Issue 46140: Some API methods could take const Py_buffer* instead of Py_buffer * - Python tracker
The Wayback Machine - https://web.archive.org/web/20220324083117/https://bugs.python.org/issue46140

➜

This issue tracker will soon become read-only and move to GitHub.
For a smoother transition, remember to log in and link your GitHub username to your profile.
For more information, see this post about the migration.

classification
Title: Some API methods could take const Py_buffer* instead of Py_buffer *
Type: Stage: resolved
Components: Versions: Python 3.11
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: davidhewitt, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2021-12-20 22:26 by davidhewitt, last changed 2021-12-22 13:08 by serhiy.storchaka. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 30217 merged davidhewitt, 2021-12-20 22:34
Messages (3)
msg408976 - (view) Author: David Hewitt (davidhewitt) * Date: 2021-12-20 22:26
The limited api methods `PyBuffer_GetPointer`, `PyBuffer_FromContiguous`, `PyBuffer_ToContiguous` and `PyMemoryView_FromBuffer` take buffer arguments as `Py_buffer *`.

They do not mutate the buffer info, so could simply take `const Py_buffer *`.

There is already precedent to take `const Py_buffer *` argument in `PyBuffer_IsContiguous`.

I'm going to submit a PR to fix.
msg409032 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-12-22 13:08
New changeset 31ff96712e8f89ac1056c2da880b44650002219f by David Hewitt in branch 'main':
bpo-46140: take more Py_buffer arguments as const * (GH-30217)
https://github.com/python/cpython/commit/31ff96712e8f89ac1056c2da880b44650002219f
msg409033 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-12-22 13:08
Thank you for your contribution David.
History
Date User Action Args
2021-12-22 13:08:49serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: + msg409033

stage: patch review -> resolved
2021-12-22 13:08:02serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg409032
2021-12-20 22:34:57davidhewittsetkeywords: + patch
stage: patch review
pull_requests: + pull_request28438
2021-12-20 22:26:56davidhewittcreate