Skip to content

Commit 72ec253

Browse files
Merge branch 'main' into stackref_tests
2 parents 63ea804 + b420f6b commit 72ec253

File tree

130 files changed

+2912
-981
lines changed

Some content is hidden

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

130 files changed

+2912
-981
lines changed

.github/workflows/jit.yml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,9 @@ jobs:
5757
fail-fast: false
5858
matrix:
5959
target:
60-
# To re-enable later when we support these.
61-
# - i686-pc-windows-msvc/msvc
62-
# - x86_64-pc-windows-msvc/msvc
63-
# - aarch64-pc-windows-msvc/msvc
60+
- i686-pc-windows-msvc/msvc
61+
- x86_64-pc-windows-msvc/msvc
62+
- aarch64-pc-windows-msvc/msvc
6463
- x86_64-apple-darwin/clang
6564
- aarch64-apple-darwin/clang
6665
- x86_64-unknown-linux-gnu/gcc
@@ -71,16 +70,15 @@ jobs:
7170
llvm:
7271
- 21
7372
include:
74-
# To re-enable later when we support these.
75-
# - target: i686-pc-windows-msvc/msvc
76-
# architecture: Win32
77-
# runner: windows-2022
78-
# - target: x86_64-pc-windows-msvc/msvc
79-
# architecture: x64
80-
# runner: windows-2022
81-
# - target: aarch64-pc-windows-msvc/msvc
82-
# architecture: ARM64
83-
# runner: windows-11-arm
73+
- target: i686-pc-windows-msvc/msvc
74+
architecture: Win32
75+
runner: windows-2022
76+
- target: x86_64-pc-windows-msvc/msvc
77+
architecture: x64
78+
runner: windows-2022
79+
- target: aarch64-pc-windows-msvc/msvc
80+
architecture: ARM64
81+
runner: windows-11-arm
8482
- target: x86_64-apple-darwin/clang
8583
architecture: x86_64
8684
runner: macos-15-intel

Doc/c-api/concrete.rst

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

Doc/c-api/dict.rst

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,3 +477,92 @@ Dictionary View Objects
477477
478478
Return true if *op* is an instance of a dictionary items view. This function
479479
always succeeds.
480+
481+
482+
Ordered Dictionaries
483+
^^^^^^^^^^^^^^^^^^^^
484+
485+
Python's C API provides interface for :class:`collections.OrderedDict` from C.
486+
Since Python 3.7, dictionaries are ordered by default, so there is usually
487+
little need for these functions; prefer ``PyDict*`` where possible.
488+
489+
490+
.. c:var:: PyTypeObject PyODict_Type
491+
492+
Type object for ordered dictionaries. This is the same object as
493+
:class:`collections.OrderedDict` in the Python layer.
494+
495+
496+
.. c:function:: int PyODict_Check(PyObject *od)
497+
498+
Return true if *od* is an ordered dictionary object or an instance of a
499+
subtype of the :class:`~collections.OrderedDict` type. This function
500+
always succeeds.
501+
502+
503+
.. c:function:: int PyODict_CheckExact(PyObject *od)
504+
505+
Return true if *od* is an ordered dictionary object, but not an instance of
506+
a subtype of the :class:`~collections.OrderedDict` type.
507+
This function always succeeds.
508+
509+
510+
.. c:var:: PyTypeObject PyODictKeys_Type
511+
512+
Analogous to :c:type:`PyDictKeys_Type` for ordered dictionaries.
513+
514+
515+
.. c:var:: PyTypeObject PyODictValues_Type
516+
517+
Analogous to :c:type:`PyDictValues_Type` for ordered dictionaries.
518+
519+
520+
.. c:var:: PyTypeObject PyODictItems_Type
521+
522+
Analogous to :c:type:`PyDictItems_Type` for ordered dictionaries.
523+
524+
525+
.. c:function:: PyObject *PyODict_New(void)
526+
527+
Return a new empty ordered dictionary, or ``NULL`` on failure.
528+
529+
This is analogous to :c:func:`PyDict_New`.
530+
531+
532+
.. c:function:: int PyODict_SetItem(PyObject *od, PyObject *key, PyObject *value)
533+
534+
Insert *value* into the ordered dictionary *od* with a key of *key*.
535+
Return ``0`` on success or ``-1`` with an exception set on failure.
536+
537+
This is analogous to :c:func:`PyDict_SetItem`.
538+
539+
540+
.. c:function:: int PyODict_DelItem(PyObject *od, PyObject *key)
541+
542+
Remove the entry in the ordered dictionary *od* with key *key*.
543+
Return ``0`` on success or ``-1`` with an exception set on failure.
544+
545+
This is analogous to :c:func:`PyDict_DelItem`.
546+
547+
548+
These are :term:`soft deprecated` aliases to ``PyDict`` APIs:
549+
550+
551+
.. list-table::
552+
:widths: auto
553+
:header-rows: 1
554+
555+
* * ``PyODict``
556+
* ``PyDict``
557+
* * .. c:macro:: PyODict_GetItem(od, key)
558+
* :c:func:`PyDict_GetItem`
559+
* * .. c:macro:: PyODict_GetItemWithError(od, key)
560+
* :c:func:`PyDict_GetItemWithError`
561+
* * .. c:macro:: PyODict_GetItemString(od, key)
562+
* :c:func:`PyDict_GetItemString`
563+
* * .. c:macro:: PyODict_Contains(od, key)
564+
* :c:func:`PyDict_Contains`
565+
* * .. c:macro:: PyODict_Size(od)
566+
* :c:func:`PyDict_Size`
567+
* * .. c:macro:: PyODict_SIZE(od)
568+
* :c:func:`PyDict_GET_SIZE`

Doc/c-api/float.rst

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Floating-Point Objects
8787
``<math.h>`` header.
8888
8989
.. deprecated:: 3.15
90-
The macro is soft deprecated.
90+
The macro is :term:`soft deprecated`.
9191
9292
9393
.. c:macro:: Py_NAN
@@ -99,6 +99,14 @@ Floating-Point Objects
9999
the C11 standard ``<math.h>`` header.
100100
101101
102+
.. c:macro:: Py_HUGE_VAL
103+
104+
Equivalent to :c:macro:`!INFINITY`.
105+
106+
.. deprecated:: 3.14
107+
The macro is :term:`soft deprecated`.
108+
109+
102110
.. c:macro:: Py_MATH_E
103111
104112
The definition (accurate for a :c:expr:`double` type) of the :data:`math.e` constant.
@@ -147,6 +155,34 @@ Floating-Point Objects
147155
return PyFloat_FromDouble(copysign(INFINITY, sign));
148156
149157
158+
.. c:macro:: Py_IS_FINITE(X)
159+
160+
Return ``1`` if the given floating-point number *X* is finite,
161+
that is, it is normal, subnormal or zero, but not infinite or NaN.
162+
Return ``0`` otherwise.
163+
164+
.. deprecated:: 3.14
165+
The macro is :term:`soft deprecated`. Use :c:macro:`!isfinite` instead.
166+
167+
168+
.. c:macro:: Py_IS_INFINITY(X)
169+
170+
Return ``1`` if the given floating-point number *X* is positive or negative
171+
infinity. Return ``0`` otherwise.
172+
173+
.. deprecated:: 3.14
174+
The macro is :term:`soft deprecated`. Use :c:macro:`!isinf` instead.
175+
176+
177+
.. c:macro:: Py_IS_NAN(X)
178+
179+
Return ``1`` if the given floating-point number *X* is a not-a-number (NaN)
180+
value. Return ``0`` otherwise.
181+
182+
.. deprecated:: 3.14
183+
The macro is :term:`soft deprecated`. Use :c:macro:`!isnan` instead.
184+
185+
150186
Pack and Unpack functions
151187
-------------------------
152188

Doc/c-api/intro.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,14 @@ complete listing.
183183

184184
.. versionadded:: 3.6
185185

186+
.. c:macro:: Py_MEMCPY(dest, src, n)
187+
188+
This is a :term:`soft deprecated` alias to :c:func:`!memcpy`.
189+
Use :c:func:`!memcpy` directly instead.
190+
191+
.. deprecated:: 3.14
192+
The macro is :term:`soft deprecated`.
193+
186194
.. c:macro:: Py_MIN(x, y)
187195
188196
Return the minimum value between ``x`` and ``y``.

Doc/c-api/iterator.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ Other Iterator Objects
108108
.. c:var:: PyTypeObject PyDictRevIterValue_Type
109109
.. c:var:: PyTypeObject PyDictIterItem_Type
110110
.. c:var:: PyTypeObject PyDictRevIterItem_Type
111+
.. c:var:: PyTypeObject PyODictIter_Type
111112
112113
Type objects for iterators of various built-in objects.
113114

Doc/c-api/picklebuffer.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.

Doc/c-api/structures.rst

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

0 commit comments

Comments
 (0)