Skip to content

Commit a0d814b

Browse files
authored
Merge branch 'main' into virtual-iterators
2 parents 0efab59 + fbe7b87 commit a0d814b

File tree

114 files changed

+3256
-965
lines changed

Some content is hidden

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

114 files changed

+3256
-965
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ permissions:
1515
contents: read
1616

1717
concurrency:
18-
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-reusable
18+
# https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#concurrency
19+
# 'group' must be a key uniquely representing a PR or push event.
20+
# github.workflow is the workflow name
21+
# github.actor is the user invoking the workflow
22+
# github.head_ref is the source branch of the PR or otherwise blank
23+
# github.run_id is a unique number for the current run
24+
group: ${{ github.workflow }}-${{ github.actor }}-${{ github.head_ref || github.run_id }}
1925
cancel-in-progress: true
2026

2127
env:

Doc/c-api/typeobj.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Quick Reference
7979
| :c:member:`~PyTypeObject.tp_setattro` | :c:type:`setattrofunc` | __setattr__, | X | X | | G |
8080
| | | __delattr__ | | | | |
8181
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
82-
| :c:member:`~PyTypeObject.tp_as_buffer` | :c:type:`PyBufferProcs` * | | | | | % |
82+
| :c:member:`~PyTypeObject.tp_as_buffer` | :c:type:`PyBufferProcs` * | :ref:`sub-slots` | | | | % |
8383
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
8484
| :c:member:`~PyTypeObject.tp_flags` | unsigned long | | X | X | | ? |
8585
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
@@ -325,9 +325,10 @@ sub-slots
325325
+---------------------------------------------------------+-----------------------------------+---------------+
326326
| |
327327
+---------------------------------------------------------+-----------------------------------+---------------+
328-
| :c:member:`~PyBufferProcs.bf_getbuffer` | :c:func:`getbufferproc` | |
328+
| :c:member:`~PyBufferProcs.bf_getbuffer` | :c:func:`getbufferproc` | __buffer__ |
329329
+---------------------------------------------------------+-----------------------------------+---------------+
330-
| :c:member:`~PyBufferProcs.bf_releasebuffer` | :c:func:`releasebufferproc` | |
330+
| :c:member:`~PyBufferProcs.bf_releasebuffer` | :c:func:`releasebufferproc` | __release_\ |
331+
| | | buffer\__ |
331332
+---------------------------------------------------------+-----------------------------------+---------------+
332333

333334
.. _slot-typedefs-table:

Doc/howto/isolating-extensions.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,21 +215,36 @@ multiple interpreters correctly. If this is not yet the case for your
215215
module, you can explicitly make your module loadable only once per
216216
process. For example::
217217

218+
// A process-wide flag
218219
static int loaded = 0;
219220

221+
// Mutex to provide thread safety (only needed for free-threaded Python)
222+
static PyMutex modinit_mutex = {0};
223+
220224
static int
221225
exec_module(PyObject* module)
222226
{
227+
PyMutex_Lock(&modinit_mutex);
223228
if (loaded) {
229+
PyMutex_Unlock(&modinit_mutex);
224230
PyErr_SetString(PyExc_ImportError,
225231
"cannot load module more than once per process");
226232
return -1;
227233
}
228234
loaded = 1;
235+
PyMutex_Unlock(&modinit_mutex);
229236
// ... rest of initialization
230237
}
231238

232239

240+
If your module's :c:member:`PyModuleDef.m_clear` function is able to prepare
241+
for future re-initialization, it should clear the ``loaded`` flag.
242+
In this case, your module won't support multiple instances existing
243+
*concurrently*, but it will, for example, support being loaded after
244+
Python runtime shutdown (:c:func:`Py_FinalizeEx`) and re-initialization
245+
(:c:func:`Py_Initialize`).
246+
247+
233248
Module State Access from Functions
234249
----------------------------------
235250

Doc/library/archiving.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ Data Compression and Archiving
55
******************************
66

77
The modules described in this chapter support data compression with the zlib,
8-
gzip, bzip2 and lzma algorithms, and the creation of ZIP- and tar-format
8+
gzip, bzip2, lzma, and zstd algorithms, and the creation of ZIP- and tar-format
99
archives. See also :ref:`archiving-operations` provided by the :mod:`shutil`
1010
module.
1111

1212

1313
.. toctree::
1414

15+
compression.rst
16+
compression.zstd.rst
1517
zlib.rst
1618
gzip.rst
1719
bz2.rst

Doc/library/compression.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
The :mod:`!compression` package
2+
===============================
3+
4+
.. versionadded:: 3.14
5+
6+
The :mod:`!compression` package contains the canonical compression modules
7+
containing interfaces to several different compression algorithms. Some of
8+
these modules have historically been available as separate modules; those will
9+
continue to be available under their original names for compatibility reasons,
10+
and will not be removed without a deprecation cycle. The use of modules in
11+
:mod:`!compression` is encouraged where practical.
12+
13+
* :mod:`!compression.bz2` -- Re-exports :mod:`bz2`
14+
* :mod:`!compression.gzip` -- Re-exports :mod:`gzip`
15+
* :mod:`!compression.lzma` -- Re-exports :mod:`lzma`
16+
* :mod:`!compression.zlib` -- Re-exports :mod:`zlib`
17+
* :mod:`compression.zstd` -- Wrapper for the Zstandard compression library
18+

0 commit comments

Comments
 (0)