Skip to content

Commit 79096c8

Browse files
committed
Merge branch 'main' of https://github.com/python/cpython into gilstate-thread-local
2 parents 9f1d919 + 9859791 commit 79096c8

Some content is hidden

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

54 files changed

+1109
-389
lines changed

Doc/c-api/gcsupport.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,9 @@ provided. In order to use this macro, the :c:member:`~PyTypeObject.tp_traverse`
180180
must name its arguments exactly *visit* and *arg*:
181181
182182
183-
.. c:function:: void Py_VISIT(PyObject *o)
183+
.. c:macro:: Py_VISIT(o)
184184
185-
If *o* is not ``NULL``, call the *visit* callback, with arguments *o*
185+
If the :c:expr:`PyObject *` *o* is not ``NULL``, call the *visit* callback, with arguments *o*
186186
and *arg*. If *visit* returns a non-zero value, then return it.
187187
Using this macro, :c:member:`~PyTypeObject.tp_traverse` handlers
188188
look like::

Doc/howto/free-threading-extensions.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ You can use it to enable code that only runs under the free-threaded build::
2323
/* code that only runs in the free-threaded build */
2424
#endif
2525

26+
.. note::
27+
28+
On Windows, this macro is not defined automatically, but must be specified
29+
to the compiler when building. The :func:`sysconfig.get_config_var` function
30+
can be used to determine whether the current running interpreter had the
31+
macro defined.
32+
33+
2634
Module Initialization
2735
=====================
2836

Doc/howto/functional.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,8 @@ have the form::
372372
for expr2 in sequence2
373373
if condition2
374374
for expr3 in sequence3
375-
...
376375
if condition3
376+
...
377377
for exprN in sequenceN
378378
if conditionN )
379379

Doc/library/multiprocessing.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,6 +1369,12 @@ object -- see :ref:`multiprocessing-managers`.
13691369
A solitary difference from its close analog exists: its ``acquire`` method's
13701370
first argument is named *block*, as is consistent with :meth:`Lock.acquire`.
13711371

1372+
.. method:: locked()
1373+
1374+
Return a boolean indicating whether this object is locked right now.
1375+
1376+
.. versionadded:: 3.14
1377+
13721378
.. note::
13731379
On macOS, this is indistinguishable from :class:`Semaphore` because
13741380
``sem_getvalue()`` is not implemented on that platform.
@@ -1521,6 +1527,12 @@ object -- see :ref:`multiprocessing-managers`.
15211527
A solitary difference from its close analog exists: its ``acquire`` method's
15221528
first argument is named *block*, as is consistent with :meth:`Lock.acquire`.
15231529

1530+
.. method:: locked()
1531+
1532+
Return a boolean indicating whether this object is locked right now.
1533+
1534+
.. versionadded:: 3.14
1535+
15241536
.. note::
15251537

15261538
On macOS, ``sem_timedwait`` is unsupported, so calling ``acquire()`` with

Doc/library/re.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -991,8 +991,8 @@ Functions
991991
That way, separator components are always found at the same relative
992992
indices within the result list.
993993

994-
Empty matches for the pattern split the string only when not adjacent
995-
to a previous empty match.
994+
Adjacent empty matches are not possible, but an empty match can occur
995+
immediately after a non-empty match.
996996

997997
.. code:: pycon
998998
@@ -1095,9 +1095,12 @@ Functions
10951095

10961096
The optional argument *count* is the maximum number of pattern occurrences to be
10971097
replaced; *count* must be a non-negative integer. If omitted or zero, all
1098-
occurrences will be replaced. Empty matches for the pattern are replaced only
1099-
when not adjacent to a previous empty match, so ``sub('x*', '-', 'abxd')`` returns
1100-
``'-a-b--d-'``.
1098+
occurrences will be replaced.
1099+
1100+
Adjacent empty matches are not possible, but an empty match can occur
1101+
immediately after a non-empty match.
1102+
As a result, ``sub('x*', '-', 'abxd')`` returns ``'-a-b--d-'``
1103+
instead of ``'-a-b-d-'``.
11011104

11021105
.. index:: single: \g; in regular expressions
11031106

@@ -1128,8 +1131,7 @@ Functions
11281131
.. versionchanged:: 3.7
11291132
Unknown escapes in *repl* consisting of ``'\'`` and an ASCII letter
11301133
now are errors.
1131-
Empty matches for the pattern are replaced when adjacent to a previous
1132-
non-empty match.
1134+
An empty match can occur immediately after a non-empty match.
11331135

11341136
.. versionchanged:: 3.12
11351137
Group *id* can only contain ASCII digits.

Doc/tutorial/controlflow.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@ Here is an example of a multi-line docstring::
10561056
>>> print(my_function.__doc__)
10571057
Do nothing, but document it.
10581058

1059-
No, really, it doesn't do anything.
1059+
No, really, it doesn't do anything.
10601060

10611061

10621062
.. _tut-annotations:

Doc/whatsnew/3.14.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,12 @@ Kumar Aditya, Edgar Margffoy, and many others.
829829
Some of these contributors are employed by Meta, which has continued to provide
830830
significant engineering resources to support this project.
831831

832+
From 3.14, when compiling extension modules for the free-threaded build of
833+
CPython on Windows, the preprocessor variable ``Py_GIL_DISABLED`` now needs to
834+
be specified by the build backend, as it will no longer be determined
835+
automatically by the C compiler. For a running interpreter, the setting that
836+
was used at compile time can be found using :func:`sysconfig.get_config_var`.
837+
832838

833839
.. _whatsnew314-pyrepl-highlighting:
834840

Doc/whatsnew/3.15.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,15 @@ sysconfig
145145
(Contributed by Filipe Laíns in :gh:`92897`.)
146146

147147

148+
threading
149+
---------
150+
151+
* Remove support for arbitrary positional or keyword arguments in the C
152+
implementation of :class:`~threading.RLock` objects. This was deprecated
153+
in Python 3.14.
154+
(Contributed by Bénédikt Tran in :gh:`134087`.)
155+
156+
148157
typing
149158
------
150159

Include/Python.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@
5959
# include <intrin.h> // __readgsqword()
6060
#endif
6161

62+
// Suppress known warnings in Python header files.
63+
#if defined(_MSC_VER)
64+
// Warning that alignas behaviour has changed. Doesn't affect us, because we
65+
// never relied on the old behaviour.
66+
#pragma warning(push)
67+
#pragma warning(disable: 5274)
68+
#endif
69+
6270
// Include Python header files
6371
#include "pyport.h"
6472
#include "pymacro.h"
@@ -138,4 +146,9 @@
138146
#include "cpython/pyfpe.h"
139147
#include "cpython/tracemalloc.h"
140148

149+
// Restore warning filter
150+
#ifdef _MSC_VER
151+
#pragma warning(pop)
152+
#endif
153+
141154
#endif /* !Py_PYTHON_H */

Include/internal/pycore_opcode_metadata.h

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)