Skip to content

Commit e47b3ff

Browse files
committed
Deploying to gh-pages from @ e1712e3 🚀
1 parent c2937a1 commit e47b3ff

File tree

575 files changed

+1296
-593
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

575 files changed

+1296
-593
lines changed

_sources/c-api/concrete.rst.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ Other Objects
109109
descriptor.rst
110110
slice.rst
111111
memoryview.rst
112+
picklebuffer.rst
112113
weakref.rst
113114
capsule.rst
114115
frame.rst
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
.. highlight:: c
2+
3+
.. _picklebuffer-objects:
4+
5+
.. index::
6+
pair: object; PickleBuffer
7+
8+
Pickle buffer objects
9+
---------------------
10+
11+
.. versionadded:: 3.8
12+
13+
A :class:`pickle.PickleBuffer` object wraps a :ref:`buffer-providing object
14+
<bufferobjects>` for out-of-band data transfer with the :mod:`pickle` module.
15+
16+
17+
.. c:var:: PyTypeObject PyPickleBuffer_Type
18+
19+
This instance of :c:type:`PyTypeObject` represents the Python pickle buffer type.
20+
This is the same object as :class:`pickle.PickleBuffer` in the Python layer.
21+
22+
23+
.. c:function:: int PyPickleBuffer_Check(PyObject *op)
24+
25+
Return true if *op* is a pickle buffer instance.
26+
This function always succeeds.
27+
28+
29+
.. c:function:: PyObject *PyPickleBuffer_FromObject(PyObject *obj)
30+
31+
Create a pickle buffer from the object *obj*.
32+
33+
This function will fail if *obj* doesn't support the :ref:`buffer protocol <bufferobjects>`.
34+
35+
On success, return a new pickle buffer instance.
36+
On failure, set an exception and return ``NULL``.
37+
38+
Analogous to calling :class:`pickle.PickleBuffer` with *obj* in Python.
39+
40+
41+
.. c:function:: const Py_buffer *PyPickleBuffer_GetBuffer(PyObject *picklebuf)
42+
43+
Get a pointer to the underlying :c:type:`Py_buffer` that the pickle buffer wraps.
44+
45+
The returned pointer is valid as long as *picklebuf* is alive and has not been
46+
released. The caller must not modify or free the returned :c:type:`Py_buffer`.
47+
If the pickle buffer has been released, raise :exc:`ValueError`.
48+
49+
On success, return a pointer to the buffer view.
50+
On failure, set an exception and return ``NULL``.
51+
52+
53+
.. c:function:: int PyPickleBuffer_Release(PyObject *picklebuf)
54+
55+
Release the underlying buffer held by the pickle buffer.
56+
57+
Return ``0`` on success. On failure, set an exception and return ``-1``.
58+
59+
Analogous to calling :meth:`pickle.PickleBuffer.release` in Python.

_sources/c-api/structures.rst.txt

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,25 @@ definition with the same method name.
447447
slot. This is helpful because calls to PyCFunctions are optimized more
448448
than wrapper object calls.
449449
450+
451+
.. c:var:: PyTypeObject PyCMethod_Type
452+
453+
The type object corresponding to Python C method objects. This is
454+
available as :class:`types.BuiltinMethodType` in the Python layer.
455+
456+
457+
.. c:function:: int PyCMethod_Check(PyObject *op)
458+
459+
Return true if *op* is an instance of the :c:type:`PyCMethod_Type` type
460+
or a subtype of it. This function always succeeds.
461+
462+
463+
.. c:function:: int PyCMethod_CheckExact(PyObject *op)
464+
465+
This is the same as :c:func:`PyCMethod_Check`, but does not account for
466+
subtypes.
467+
468+
450469
.. c:function:: PyObject * PyCMethod_New(PyMethodDef *ml, PyObject *self, PyObject *module, PyTypeObject *cls)
451470
452471
Turn *ml* into a Python :term:`callable` object.
@@ -472,6 +491,24 @@ definition with the same method name.
472491
.. versionadded:: 3.9
473492
474493
494+
.. c:var:: PyTypeObject PyCFunction_Type
495+
496+
The type object corresponding to Python C function objects. This is
497+
available as :class:`types.BuiltinFunctionType` in the Python layer.
498+
499+
500+
.. c:function:: int PyCFunction_Check(PyObject *op)
501+
502+
Return true if *op* is an instance of the :c:type:`PyCFunction_Type` type
503+
or a subtype of it. This function always succeeds.
504+
505+
506+
.. c:function:: int PyCFunction_CheckExact(PyObject *op)
507+
508+
This is the same as :c:func:`PyCFunction_Check`, but does not account for
509+
subtypes.
510+
511+
475512
.. c:function:: PyObject * PyCFunction_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module)
476513
477514
Equivalent to ``PyCMethod_New(ml, self, module, NULL)``.
@@ -482,6 +519,62 @@ definition with the same method name.
482519
Equivalent to ``PyCMethod_New(ml, self, NULL, NULL)``.
483520
484521
522+
.. c:function:: int PyCFunction_GetFlags(PyObject *func)
523+
524+
Get the function's flags on *func* as they were passed to
525+
:c:member:`~PyMethodDef.ml_flags`.
526+
527+
If *func* is not a C function object, this fails with an exception.
528+
*func* must not be ``NULL``.
529+
530+
This function returns the function's flags on success, and ``-1`` with an
531+
exception set on failure.
532+
533+
534+
.. c:function:: int PyCFunction_GET_FLAGS(PyObject *func)
535+
536+
This is the same as :c:func:`PyCFunction_GetFlags`, but without error
537+
or type checking.
538+
539+
540+
.. c:function:: PyCFunction PyCFunction_GetFunction(PyObject *func)
541+
542+
Get the function pointer on *func* as it was passed to
543+
:c:member:`~PyMethodDef.ml_meth`.
544+
545+
If *func* is not a C function object, this fails with an exception.
546+
*func* must not be ``NULL``.
547+
548+
This function returns the function pointer on success, and ``NULL`` with an
549+
exception set on failure.
550+
551+
552+
.. c:function:: int PyCFunction_GET_FUNCTION(PyObject *func)
553+
554+
This is the same as :c:func:`PyCFunction_GetFunction`, but without error
555+
or type checking.
556+
557+
558+
.. c:function:: PyObject *PyCFunction_GetSelf(PyObject *func)
559+
560+
Get the "self" object on *func*. This is the object that would be passed
561+
to the first argument of a :c:type:`PyCFunction`. For C function objects
562+
created through a :c:type:`PyMethodDef` on a :c:type:`PyModuleDef`, this
563+
is the resulting module object.
564+
565+
If *func* is not a C function object, this fails with an exception.
566+
*func* must not be ``NULL``.
567+
568+
This function returns a :term:`borrowed reference` to the "self" object
569+
on success, and ``NULL`` with an exception set on failure.
570+
571+
572+
.. c:function:: PyObject *PyCFunction_GET_SELF(PyObject *func)
573+
574+
This is the same as :c:func:`PyCFunction_GetSelf`, but without error or
575+
type checking.
576+
577+
485578
Accessing attributes of extension types
486579
---------------------------------------
487580

about.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ <h3>導航</h3>
314314
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
315315
<br>
316316
<br>
317-
最後更新於 11月 16, 2025 (09:41 UTC)。
317+
最後更新於 11月 17, 2025 (02:27 UTC)。
318318

319319
<a href="/bugs.html">發現 bug</a>
320320

bugs.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ <h3>導航</h3>
351351
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
352352
<br>
353353
<br>
354-
最後更新於 11月 16, 2025 (09:41 UTC)。
354+
最後更新於 11月 17, 2025 (02:27 UTC)。
355355

356356
<a href="/bugs.html">發現 bug</a>
357357

c-api/abstract.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ <h3>導航</h3>
323323
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
324324
<br>
325325
<br>
326-
最後更新於 11月 16, 2025 (09:41 UTC)。
326+
最後更新於 11月 17, 2025 (02:27 UTC)。
327327

328328
<a href="/bugs.html">發現 bug</a>
329329

c-api/allocation.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ <h3>導航</h3>
532532
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
533533
<br>
534534
<br>
535-
最後更新於 11月 16, 2025 (09:41 UTC)。
535+
最後更新於 11月 17, 2025 (02:27 UTC)。
536536

537537
<a href="/bugs.html">發現 bug</a>
538538

c-api/apiabiversion.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ <h3>導航</h3>
471471
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
472472
<br>
473473
<br>
474-
最後更新於 11月 16, 2025 (09:41 UTC)。
474+
最後更新於 11月 17, 2025 (02:27 UTC)。
475475

476476
<a href="/bugs.html">發現 bug</a>
477477

c-api/arg.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ <h3>導航</h3>
954954
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
955955
<br>
956956
<br>
957-
最後更新於 11月 16, 2025 (09:41 UTC)。
957+
最後更新於 11月 17, 2025 (02:27 UTC)。
958958

959959
<a href="/bugs.html">發現 bug</a>
960960

c-api/bool.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ <h3>導航</h3>
334334
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
335335
<br>
336336
<br>
337-
最後更新於 11月 16, 2025 (09:41 UTC)。
337+
最後更新於 11月 17, 2025 (02:27 UTC)。
338338

339339
<a href="/bugs.html">發現 bug</a>
340340

0 commit comments

Comments
 (0)