Skip to content

Commit 3e2b962

Browse files
Merge remote-tracking branch 'origin/main' into growable-ring-buffer
2 parents cd926b5 + 92741c5 commit 3e2b962

32 files changed

+693
-66
lines changed

Doc/c-api/conversion.rst

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,58 @@ The following functions provide locale-independent string to number conversions.
172172
173173
Case insensitive comparison of strings. The function works almost
174174
identically to :c:func:`!strncmp` except that it ignores the case.
175+
176+
177+
Character classification and conversion
178+
=======================================
179+
180+
The following macros provide locale-independent (unlike the C standard library
181+
``ctype.h``) character classification and conversion.
182+
The argument must be a signed or unsigned :c:expr:`char`.
183+
184+
185+
.. c:macro:: Py_ISALNUM(c)
186+
187+
Return true if the character *c* is an alphanumeric character.
188+
189+
190+
.. c:macro:: Py_ISALPHA(c)
191+
192+
Return true if the character *c* is an alphabetic character (``a-z`` and ``A-Z``).
193+
194+
195+
.. c:macro:: Py_ISDIGIT(c)
196+
197+
Return true if the character *c* is a decimal digit (``0-9``).
198+
199+
200+
.. c:macro:: Py_ISLOWER(c)
201+
202+
Return true if the character *c* is a lowercase ASCII letter (``a-z``).
203+
204+
205+
.. c:macro:: Py_ISUPPER(c)
206+
207+
Return true if the character *c* is an uppercase ASCII letter (``A-Z``).
208+
209+
210+
.. c:macro:: Py_ISSPACE(c)
211+
212+
Return true if the character *c* is a whitespace character (space, tab,
213+
carriage return, newline, vertical tab, or form feed).
214+
215+
216+
.. c:macro:: Py_ISXDIGIT(c)
217+
218+
Return true if the character *c* is a hexadecimal digit (``0-9``, ``a-f``, and
219+
``A-F``).
220+
221+
222+
.. c:macro:: Py_TOLOWER(c)
223+
224+
Return the lowercase equivalent of the character *c*.
225+
226+
227+
.. c:macro:: Py_TOUPPER(c)
228+
229+
Return the uppercase equivalent of the character *c*.

Doc/c-api/float.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,20 @@ Floating-Point Objects
7878
Return the minimum normalized positive float *DBL_MIN* as C :c:expr:`double`.
7979
8080
81+
.. c:macro:: Py_MATH_El
82+
83+
High precision (long double) definition of :data:`~math.e` constant.
84+
85+
.. deprecated-removed:: 3.15 3.20
86+
87+
88+
.. c:macro:: Py_MATH_PIl
89+
90+
High precision (long double) definition of :data:`~math.pi` constant.
91+
92+
.. deprecated-removed:: 3.15 3.20
93+
94+
8195
.. c:macro:: Py_RETURN_NAN
8296
8397
Return :data:`math.nan` from a function.

Doc/c-api/frame.rst

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ See also :ref:`Reflection <reflection>`.
2929
Previously, this type was only available after including
3030
``<frameobject.h>``.
3131

32+
.. c:function:: PyFrameObject *PyFrame_New(PyThreadState *tstate, PyCodeObject *code, PyObject *globals, PyObject *locals)
33+
34+
Create a new frame object. This function returns a :term:`strong reference`
35+
to the new frame object on success, and returns ``NULL`` with an exception
36+
set on failure.
37+
3238
.. c:function:: int PyFrame_Check(PyObject *obj)
3339
3440
Return non-zero if *obj* is a frame object.
@@ -161,6 +167,57 @@ See :pep:`667` for more information.
161167
162168
Return non-zero if *obj* is a frame :func:`locals` proxy.
163169
170+
171+
Legacy Local Variable APIs
172+
^^^^^^^^^^^^^^^^^^^^^^^^^^
173+
174+
These APIs are :term:`soft deprecated`. As of Python 3.13, they do nothing.
175+
They exist solely for backwards compatibility.
176+
177+
178+
.. c:function:: void PyFrame_LocalsToFast(PyFrameObject *f, int clear)
179+
180+
This function is :term:`soft deprecated` and does nothing.
181+
182+
Prior to Python 3.13, this function would copy the :attr:`~frame.f_locals`
183+
attribute of *f* to the internal "fast" array of local variables, allowing
184+
changes in frame objects to be visible to the interpreter. If *clear* was
185+
true, this function would process variables that were unset in the locals
186+
dictionary.
187+
188+
.. versionchanged:: 3.13
189+
This function now does nothing.
190+
191+
192+
.. c:function:: void PyFrame_FastToLocals(PyFrameObject *f)
193+
194+
This function is :term:`soft deprecated` and does nothing.
195+
196+
Prior to Python 3.13, this function would copy the internal "fast" array
197+
of local variables (which is used by the interpreter) to the
198+
:attr:`~frame.f_locals` attribute of *f*, allowing changes in local
199+
variables to be visible to frame objects.
200+
201+
.. versionchanged:: 3.13
202+
This function now does nothing.
203+
204+
205+
.. c:function:: int PyFrame_FastToLocalsWithError(PyFrameObject *f)
206+
207+
This function is :term:`soft deprecated` and does nothing.
208+
209+
Prior to Python 3.13, this function was similar to
210+
:c:func:`PyFrame_FastToLocals`, but would return ``0`` on success, and
211+
``-1`` with an exception set on failure.
212+
213+
.. versionchanged:: 3.13
214+
This function now does nothing.
215+
216+
217+
.. seealso::
218+
:pep:`667`
219+
220+
164221
Internal Frames
165222
^^^^^^^^^^^^^^^
166223

Doc/c-api/type.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,18 @@ Type Objects
133133
Type features are denoted by single bit flags.
134134
135135
136+
.. c:function:: int PyType_FastSubclass(PyTypeObject *type, int flag)
137+
138+
Return non-zero if the type object *type* sets the subclass flag *flag*.
139+
Subclass flags are denoted by
140+
:c:macro:`Py_TPFLAGS_*_SUBCLASS <Py_TPFLAGS_LONG_SUBCLASS>`.
141+
This function is used by many ``_Check`` functions for common types.
142+
143+
.. seealso::
144+
:c:func:`PyObject_TypeCheck`, which is used as a slower alternative in
145+
``_Check`` functions for types that don't come with subclass flags.
146+
147+
136148
.. c:function:: int PyType_IS_GC(PyTypeObject *o)
137149
138150
Return true if the type object includes support for the cycle detector; this

Doc/c-api/typeobj.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,8 +1351,8 @@ and :c:data:`PyType_Type` effectively act as defaults.)
13511351
.. c:macro:: Py_TPFLAGS_BASE_EXC_SUBCLASS
13521352
.. c:macro:: Py_TPFLAGS_TYPE_SUBCLASS
13531353
1354-
These flags are used by functions such as
1355-
:c:func:`PyLong_Check` to quickly determine if a type is a subclass
1354+
Functions such as :c:func:`PyLong_Check` will call :c:func:`PyType_FastSubclass`
1355+
with one of these flags to quickly determine if a type is a subclass
13561356
of a built-in type; such specific checks are faster than a generic
13571357
check, like :c:func:`PyObject_IsInstance`. Custom types that inherit
13581358
from built-ins should have their :c:member:`~PyTypeObject.tp_flags`

Doc/deprecations/c-api-pending-removal-in-3.20.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ Pending removal in Python 3.20
55
Use :c:func:`PyComplex_AsCComplex` and :c:func:`PyComplex_FromCComplex`
66
to convert a Python complex number to/from the C :c:type:`Py_complex`
77
representation.
8+
9+
* Macros :c:macro:`!Py_MATH_PIl` and :c:macro:`!Py_MATH_El`.

Doc/library/functions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1859,7 +1859,7 @@ are always available. They are listed here in alphabetical order.
18591859
the same data with other ordering tools such as :func:`max` that rely
18601860
on a different underlying method. Implementing all six comparisons
18611861
also helps avoid confusion for mixed type comparisons which can call
1862-
reflected the :meth:`~object.__gt__` method.
1862+
the reflected :meth:`~object.__gt__` method.
18631863

18641864
For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`.
18651865

Doc/library/locale.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,8 +524,8 @@ The :mod:`locale` module defines the following exception and functions:
524524
SSH connections.
525525

526526
Python doesn't internally use locale-dependent character transformation functions
527-
from ``ctype.h``. Instead, an internal ``pyctype.h`` provides locale-independent
528-
equivalents like :c:macro:`!Py_TOLOWER`.
527+
from ``ctype.h``. Instead, ``pyctype.h`` provides locale-independent
528+
equivalents like :c:macro:`Py_TOLOWER`.
529529

530530

531531
.. data:: LC_COLLATE

Doc/library/msvcrt.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ api. The normal API deals only with ASCII characters and is of limited use
2222
for internationalized applications. The wide char API should be used where
2323
ever possible.
2424

25+
.. availability:: Windows.
26+
2527
.. versionchanged:: 3.3
2628
Operations in this module now raise :exc:`OSError` where :exc:`IOError`
2729
was raised.

Doc/library/multiprocessing.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ to this, the :mod:`multiprocessing` module allows the programmer to fully
2222
leverage multiple processors on a given machine. It runs on both POSIX and
2323
Windows.
2424

25-
The :mod:`multiprocessing` module also introduces APIs which do not have
26-
analogs in the :mod:`threading` module. A prime example of this is the
25+
The :mod:`multiprocessing` module also introduces the
2726
:class:`~multiprocessing.pool.Pool` object which offers a convenient means of
2827
parallelizing the execution of a function across multiple input values,
2928
distributing the input data across processes (data parallelism). The following
@@ -44,6 +43,10 @@ will print to standard output ::
4443

4544
[1, 4, 9]
4645

46+
The :mod:`multiprocessing` module also introduces APIs which do not have
47+
analogs in the :mod:`threading` module, like the ability to :meth:`terminate
48+
<Process.terminate>`, :meth:`interrupt <Process.interrupt>` or :meth:`kill
49+
<Process.kill>` a running process.
4750

4851
.. seealso::
4952

0 commit comments

Comments
 (0)