-
-
Notifications
You must be signed in to change notification settings - Fork 34.5k
gh-141004: Document the PyPickleBuffer_* C API
#141630
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
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| .. highlight:: c | ||
|
|
||
| .. _picklebuffer-objects: | ||
|
|
||
| .. index:: | ||
| pair: object; PickleBuffer | ||
|
|
||
| PickleBuffer objects | ||
| -------------------- | ||
|
|
||
| .. versionadded:: 3.8 | ||
|
|
||
| A :class:`pickle.PickleBuffer` object wraps a :ref:`buffer-providing object | ||
| <bufferobjects>` for out-of-band data transfer with the :mod:`pickle` module. | ||
|
|
||
|
|
||
| .. c:var:: PyTypeObject PyPickleBuffer_Type | ||
|
|
||
| This instance of :c:type:`PyTypeObject` represents the Python PickleBuffer type. | ||
|
StanFromIreland marked this conversation as resolved.
Outdated
|
||
| This is the same object as :class:`pickle.PickleBuffer` in the Python layer. | ||
|
|
||
|
|
||
| .. c:function:: int PyPickleBuffer_Check(PyObject *op) | ||
|
|
||
| Return true if *op* is a PickleBuffer instance. | ||
| This function always succeeds. | ||
|
|
||
|
|
||
| .. c:function:: PyObject *PyPickleBuffer_FromObject(PyObject *obj) | ||
|
|
||
| Create a PickleBuffer from the object *obj*. | ||
| *obj* must support the :ref:`buffer protocol <bufferobjects>`. | ||
|
StanFromIreland marked this conversation as resolved.
Outdated
|
||
|
|
||
| On success, return a new PickleBuffer instance. | ||
| On failure, set an exception and return ``NULL``. | ||
|
|
||
| Analogous to calling :class:`pickle.PickleBuffer` with *obj* in Python. | ||
|
|
||
|
|
||
| .. c:function:: const Py_buffer *PyPickleBuffer_GetBuffer(PyObject *picklebuf) | ||
|
|
||
| Get a pointer to the underlying :c:type:`Py_buffer` that the PickleBuffer wraps. | ||
| *picklebuf* must be a PickleBuffer instance. | ||
|
StanFromIreland marked this conversation as resolved.
Outdated
|
||
|
|
||
| On success, return a pointer to the buffer view. | ||
| The returned pointer is valid as long as *picklebuf* is alive and has not been | ||
| released. The caller must not modify or free the returned :c:type:`Py_buffer`. | ||
|
|
||
| On failure, set an exception and return ``NULL``. | ||
|
StanFromIreland marked this conversation as resolved.
Outdated
|
||
| If the PickleBuffer has been released, raise :exc:`ValueError`. | ||
|
|
||
|
|
||
| .. c:function:: int PyPickleBuffer_Release(PyObject *picklebuf) | ||
|
|
||
| Release the underlying buffer held by the PickleBuffer. | ||
|
|
||
| Return ``0`` on success. On failure, set an exception and return ``-1``. | ||
|
|
||
| Analogous to calling :meth:`pickle.PickleBuffer.release` in Python. | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.