Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit150137f

Browse files
committed
Merge branch 'main' into android-package
2 parents3dc41cb +425f60b commit150137f

File tree

539 files changed

+25053
-24578
lines changed

Some content is hidden

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

539 files changed

+25053
-24578
lines changed

‎.github/workflows/tail-call.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ jobs:
8787
set PlatformToolset=clangcl
8888
set LLVMToolsVersion=${{ matrix.llvm }}.1.5
8989
set LLVMInstallDir=C:\Program Files\LLVM
90-
./PCbuild/build.bat --tail-call-interp -d -p ${{ matrix.architecture }}
91-
./PCbuild/rt.bat -d -p ${{ matrix.architecture }} -q --multiprocess 0 --timeout 4500 --verbose2 --verbose3
90+
call./PCbuild/build.bat --tail-call-interp -d -p ${{ matrix.architecture }}
91+
call./PCbuild/rt.bat -d -p ${{ matrix.architecture }} -q --multiprocess 0 --timeout 4500 --verbose2 --verbose3
9292
9393
# No tests (yet):
9494
-name:Emulated Windows (release)

‎Doc/c-api/dict.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Dictionary Objects
127127
Prefer the:c:func:`PyDict_GetItemWithError` function instead.
128128
129129
..versionchanged::3.10
130-
Calling this API without:term:`GIL` held had been allowed for historical
130+
Calling this API withoutan:term:`attached thread state` had been allowed for historical
131131
reason. It is no longer allowed.
132132
133133

‎Doc/c-api/exceptions.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ Querying the error indicator
413413
own a reference to the return value, so you do not need to :c:func:`Py_DECREF`
414414
it.
415415
416-
The caller musthold the GIL.
416+
The caller musthave an :term:`attached thread state`.
417417
418418
.. note::
419419
@@ -675,7 +675,7 @@ Signal Handling
675675
676676
..note::
677677
This function is async-signal-safe. It can be called without
678-
the:term:`GIL` and from a C signal handler.
678+
an:term:`attached thread state` and from a C signal handler.
679679
680680
681681
..c:function::intPyErr_SetInterruptEx(int signum)
@@ -702,7 +702,7 @@ Signal Handling
702702
703703
.. note::
704704
This function is async-signal-safe. It can be called without
705-
the :term:`GIL` and from a C signal handler.
705+
an :term:`attached thread state` and from a C signal handler.
706706
707707
.. versionadded:: 3.10
708708

‎Doc/c-api/init.rst

Lines changed: 157 additions & 144 deletions
Large diffs are not rendered by default.

‎Doc/c-api/init_config.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -578,8 +578,8 @@ Some options are read from the :mod:`sys` attributes. For example, the option
578578
* ``list[str]``
579579
* ``dict[str, str]``
580580
581-
The caller musthold the GIL. The function cannot be called before
582-
Python initialization nor after Python finalization.
581+
The caller musthave an:term:`attached thread state`. The function cannot
582+
be called beforePython initialization nor after Python finalization.
583583
584584
..versionadded::3.14
585585
@@ -601,8 +601,8 @@ Some options are read from the :mod:`sys` attributes. For example, the option
601601
* Return a new reference on success.
602602
* Set an exception and return ``NULL`` on error.
603603
604-
The caller musthold the GIL. The function cannot be called before
605-
Python initialization nor after Python finalization.
604+
The caller musthave an :term:`attached thread state`. The function cannot
605+
be called beforePython initialization nor after Python finalization.
606606
607607
.. versionadded:: 3.14
608608
@@ -616,8 +616,8 @@ Some options are read from the :mod:`sys` attributes. For example, the option
616616
* Raise a:exc:`ValueError` if the option is read-only (cannot be set).
617617
* Raise a :exc:`TypeError` if *value* has not the proper type.
618618
619-
The caller musthold the GIL. The function cannot be called before
620-
Python initialization nor after Python finalization.
619+
The caller musthave an :term:`attached thread state`. The function cannot
620+
be called beforePython initialization nor after Python finalization.
621621
622622
.. versionadded:: 3.14
623623

‎Doc/c-api/memory.rst

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ The three allocation domains are:
110110

111111
* Raw domain: intended for allocating memory for general-purpose memory
112112
buffers where the allocation *must* go to the system allocator or where the
113-
allocator can operate withoutthe:term:`GIL`. The memory is requested directly
114-
from the system. See:ref:`Raw Memory Interface<raw-memoryinterface>`.
113+
allocator can operate withoutan:term:`attached thread state`. The memory
114+
is requested directlyfrom the system. See:ref:`Raw Memory Interface<raw-memoryinterface>`.
115115

116116
* "Mem" domain: intended for allocating memory for Python buffers and
117117
general-purpose memory buffers where the allocation must be performed with
118-
the:term:`GIL` held. The memory is taken from the Python private heap.
118+
an:term:`attached thread state`. The memory is taken from the Python private heap.
119119
See:ref:`Memory Interface<memoryinterface>`.
120120

121121
* Object domain: intended for allocating memory for Python objects. The
@@ -139,8 +139,8 @@ Raw Memory Interface
139139
====================
140140

141141
The following function sets are wrappers to the system allocator. These
142-
functions are thread-safe,the:term:`GIL <global interpreter lock>` does not
143-
need to beheld.
142+
functions are thread-safe,so a:term:`thread state` does not
143+
need to be:term:`attached <attached thread state>`.
144144

145145
The:ref:`default raw memory allocator<default-memory-allocators>` uses
146146
the following functions::c:func:`malloc`,:c:func:`calloc`,:c:func:`realloc`
@@ -213,8 +213,7 @@ The :ref:`default memory allocator <default-memory-allocators>` uses the
213213
214214
..warning::
215215
216-
The:term:`GIL <global interpreter lock>` must be held when using these
217-
functions.
216+
There must be an:term:`attached thread state` when using these functions.
218217
219218
..versionchanged::3.6
220219
@@ -327,8 +326,7 @@ The :ref:`default object allocator <default-memory-allocators>` uses the
327326
328327
..warning::
329328
330-
The:term:`GIL <global interpreter lock>` must be held when using these
331-
functions.
329+
There must be an:term:`attached thread state` when using these functions.
332330
333331
..c:function::void*PyObject_Malloc(size_t n)
334332
@@ -485,12 +483,12 @@ Customize Memory Allocators
485483
zero bytes.
486484
487485
For the:c:macro:`PYMEM_DOMAIN_RAW` domain, the allocator must be
488-
thread-safe:the:term:`GIL <global interpreter lock>` is notheld when the
489-
allocator is called.
486+
thread-safe:a:term:`thread state` is not:term:`attached <attached thread state>`
487+
when theallocator is called.
490488
491489
For the remaining domains, the allocator must also be thread-safe:
492490
the allocator may be called in different interpreters that do not
493-
share a``GIL``.
491+
share a:term:`GIL`.
494492
495493
If the new allocator is not a hook (does not call the previous allocator),
496494
the :c:func:`PyMem_SetupDebugHooks` function must be called to reinstall the
@@ -507,8 +505,8 @@ Customize Memory Allocators
507505
:c:func:`Py_InitializeFromConfig` to install a custom memory
508506
allocator. There are no restrictions over the installed allocator
509507
other than the ones imposed by the domain (for instance, the Raw
510-
Domain allows the allocator to be called withoutthe GIL held). See
511-
:ref:`the section on allocator domains <allocator-domains>` for more
508+
Domain allows the allocator to be called withoutan:term:`attached thread state`).
509+
See:ref:`the section on allocator domains <allocator-domains>` for more
512510
information.
513511
514512
* If called after Python has finish initializing (after
@@ -555,7 +553,7 @@ Runtime checks:
555553
called on a memory block allocated by :c:func:`PyMem_Malloc`.
556554
- Detect write before the start of the buffer (buffer underflow).
557555
- Detect write after the end of the buffer (buffer overflow).
558-
- Check thatthe:term:`GIL <global interpreter lock>` is held when
556+
- Check thatthere is an:term:`attached thread state` when
559557
allocator functions of :c:macro:`PYMEM_DOMAIN_OBJ` (ex:
560558
:c:func:`PyObject_Malloc`) and :c:macro:`PYMEM_DOMAIN_MEM` (ex:
561559
:c:func:`PyMem_Malloc`) domains are called.
@@ -620,8 +618,8 @@ PYMEM_CLEANBYTE (meaning uninitialized memory is getting used).
620618
The :c:func:`PyMem_SetupDebugHooks` function now also works on Python
621619
compiled in release mode. On error, the debug hooks now use
622620
:mod:`tracemalloc` to get the traceback where a memory block was allocated.
623-
The debug hooks now also check ifthe GILisheld when functions of
624-
:c:macro:`PYMEM_DOMAIN_OBJ` and :c:macro:`PYMEM_DOMAIN_MEM` domains are
621+
The debug hooks now also check ifthereisan :term:`attached thread state` when
622+
functions of:c:macro:`PYMEM_DOMAIN_OBJ` and :c:macro:`PYMEM_DOMAIN_MEM` domains are
625623
called.
626624
627625
.. versionchanged:: 3.8

‎Doc/c-api/module.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ since multiple such modules can be created from a single definition.
709709
mechanisms (either by calling it directly, or by referring to its
710710
implementation for details of the required state updates).
711711
712-
The caller musthold the GIL.
712+
The caller musthave an :term:`attached thread state`.
713713
714714
Return ``-1`` with an exception set on error, ``0`` on success.
715715
@@ -720,6 +720,6 @@ since multiple such modules can be created from a single definition.
720720
Removes the module object created from *def* from the interpreter state.
721721
Return ``-1`` with an exception set on error, ``0`` on success.
722722
723-
The caller musthold the GIL.
723+
The caller musthave an:term:`attached thread state`.
724724
725725
..versionadded::3.3

‎Doc/c-api/perfmaps.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ kernel/git/torvalds/linux.git/tree/tools/perf/Documentation/jit-interface.txt>`_
1616
In Python, these helper APIs can be used by libraries and features that rely
1717
on generating machine code on the fly.
1818

19-
Note that holdingthe Global Interpreter Lock (GIL) is not required for these APIs.
19+
Note that holdingan:term:`attached thread state` is not required for these APIs.
2020

2121
..c:function::intPyUnstable_PerfMapState_Init(void)
2222

‎Doc/c-api/reflection.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Reflection
5555
5656
.. c:function:: PyFrameObject* PyEval_GetFrame(void)
5757
58-
Return thecurrent thread state's frame, which is ``NULL`` if no frame is
58+
Return the:term:`attached thread state`'s frame, which is ``NULL`` if no frame is
5959
currently executing.
6060
6161
See also :c:func:`PyThreadState_GetFrame`.

‎Doc/c-api/sys.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ Operating System Utilities
232232
233233
The file descriptor is created non-inheritable (:pep:`446`).
234234
235-
The caller musthold the GIL.
235+
The caller musthave an :term:`attached thread state`.
236236
237237
.. versionadded:: 3.14
238238
@@ -378,8 +378,8 @@ accessible to C code. They all work with the current interpreter thread's
378378
silently abort the operation by raising an error subclassed from
379379
:class:`Exception` (other errors will not be silenced).
380380
381-
The hook function is always called withthe GIL held by the Python
382-
interpreter that raised the event.
381+
The hook function is always called withan :term:`attached thread state` by
382+
the Pythoninterpreter that raised the event.
383383
384384
See :pep:`578` for a detailed description of auditing. Functions in the
385385
runtime and standard library that raise events are listed in the

‎Doc/c-api/time.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ range.
5656
system time.)
5757

5858
As any other C API (unless otherwise specified), the functions must be called
59-
withthe:term:`GIL` held.
59+
withan:term:`attached thread state`.
6060

6161
..c:function::intPyTime_Monotonic(PyTime_t *result)
6262
@@ -78,29 +78,29 @@ Raw Clock Functions
7878
-------------------
7979
8080
Similar to clock functions, but don't set an exception on error and don't
81-
require the caller tohold the GIL.
81+
require the caller tohave an:term:`attached thread state`.
8282
8383
On success, the functions return ``0``.
8484
8585
On failure, they set ``*result`` to ``0`` and return ``-1``, *without* setting
86-
an exception. To get the cause of the error,acquire the GIL and call the
87-
regular (non-``Raw``) function. Note that the regular function may succeed after
86+
an exception. To get the cause of the error,:term:`attach <attached thread state>` a:term:`thread state`,
87+
and call theregular (non-``Raw``) function. Note that the regular function may succeed after
8888
the ``Raw`` one failed.
8989
9090
.. c:function:: int PyTime_MonotonicRaw(PyTime_t *result)
9191
9292
Similar to:c:func:`PyTime_Monotonic`,
93-
but don't set an exception on error and don't requireholding the GIL.
93+
but don't set an exception on error and don't requirean:term:`attached thread state`.
9494
9595
..c:function::intPyTime_PerfCounterRaw(PyTime_t *result)
9696
9797
Similar to:c:func:`PyTime_PerfCounter`,
98-
but don't set an exception on error and don't requireholding the GIL.
98+
but don't set an exception on error and don't requirean:term:`attached thread state`.
9999
100100
..c:function::intPyTime_TimeRaw(PyTime_t *result)
101101
102102
Similar to:c:func:`PyTime_Time`,
103-
but don't set an exception on error and don't requireholding the GIL.
103+
but don't set an exception on error and don't requirean:term:`attached thread state`.
104104
105105
106106
Conversion functions

‎Doc/c-api/type.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,6 @@ The following functions and structs are used to create
311311
312312
Metaclasses thatoverride :c:member:`~PyTypeObject.tp_new` are not
313313
supported, except if ``tp_new`` is ``NULL``.
314-
(For backwards compatibility, other ``PyType_From*`` functions allow
315-
such metaclasses. They ignore ``tp_new``, which may result in incomplete
316-
initialization. This is deprecated and in Python 3.14+ such metaclasses will
317-
not be supported.)
318314
319315
The *bases* argument can be used to specify base classes; it can either
320316
be only one class or a tuple of classes.

‎Doc/c-api/typeobj.rst

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ PyTypeObject Definition
473473
-----------------------
474474

475475
The structure definition for:c:type:`PyTypeObject` can be found in
476-
:file:`Include/object.h`. For convenience of reference, this repeats the
476+
:file:`Include/cpython/object.h`. For convenience of reference, this repeats the
477477
definition found there:
478478

479479
.. XXX Drop this?
@@ -731,7 +731,7 @@ and :c:data:`PyType_Type` effectively act as defaults.)
731731
object becomes part of a refcount cycle, that cycle might be collected by
732732
a garbage collection on any thread). This is not a problem for Python
733733
API calls, since the thread on which:c:member:`!tp_dealloc` is called
734-
will own the Global Interpreter Lock (GIL). However, if the object being
734+
with an:term:`attached thread state`. However, if the object being
735735
destroyed in turn destroys objects from some other C or C++ library, care
736736
should be taken to ensure that destroying those objects on the thread
737737
which called:c:member:`!tp_dealloc` will not violate any assumptions of
@@ -2154,15 +2154,13 @@ and :c:data:`PyType_Type` effectively act as defaults.)
21542154
static void
21552155
local_finalize(PyObject *self)
21562156
{
2157-
PyObject *error_type, *error_value, *error_traceback;
2158-
21592157
/* Save the current exception, if any. */
2160-
PyErr_Fetch(&error_type, &error_value, &error_traceback);
2158+
PyObject *exc = PyErr_GetRaisedException();
21612159

21622160
/* ... */
21632161

21642162
/* Restore the saved exception. */
2165-
PyErr_Restore(error_type, error_value, error_traceback);
2163+
PyErr_SetRaisedException(exc);
21662164
}
21672165

21682166
**Inheritance:**

‎Doc/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
'issue_role',
3434
'lexers',
3535
'misc_news',
36+
'pydoc_topics',
3637
'pyspecific',
3738
'sphinx.ext.coverage',
3839
'sphinx.ext.doctest',

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp