Skip to content

Commit af8f880

Browse files
authored
Merge branch 'main' into relative.venvs
2 parents b50a80c + fa23881 commit af8f880

31 files changed

+4025
-847
lines changed

.github/CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,10 @@ peps/pep-0799.rst @pablogsal
679679
peps/pep-0800.rst @JelleZijlstra
680680
peps/pep-0801.rst @warsaw
681681
peps/pep-0802.rst @AA-Turner
682+
peps/pep-0803.rst @encukou
683+
peps/pep-0804.rst @pradyunsg
684+
# ...
685+
peps/pep-0806.rst @JelleZijlstra
682686
# ...
683687
peps/pep-2026.rst @hugovk
684688
# ...

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
runs-on: ubuntu-latest
2020

2121
steps:
22-
- uses: actions/checkout@v4
22+
- uses: actions/checkout@v5
2323
with:
2424
persist-credentials: false
2525

.github/workflows/render.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727

2828
steps:
2929
- name: Checkout
30-
uses: actions/checkout@v4
30+
uses: actions/checkout@v5
3131
with:
3232
fetch-depth: 0 # fetch all history so that last modified date-times are accurate
3333

.github/workflows/test.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ jobs:
3030
fail-fast: false
3131
matrix:
3232
python-version:
33-
- "3.9"
3433
- "3.10"
3534
- "3.11"
3635
- "3.12"
@@ -42,7 +41,7 @@ jobs:
4241
- "ubuntu-latest"
4342

4443
steps:
45-
- uses: actions/checkout@v4
44+
- uses: actions/checkout@v5
4645
with:
4746
persist-credentials: false
4847

.ruff.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
output-format = "full"
2-
target-version = "py39"
2+
target-version = "py310"
33

44
[lint]
55
ignore = [

pep_sphinx_extensions/pep_theme/templates/page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ <h2>Contents</h2>
5555
{{ toc }}
5656
<br>
5757
{%- if not pagename.startswith(("pep-0000", "topic")) %}
58-
<a id="source" href="https://github.com/python/peps/blob/main/peps/{{pagename}}.rst">Page Source (GitHub)</a>
58+
<a id="source" href="https://github.com/python/peps/blob/main/peps/{{pagename}}.rst?plain=1">Page Source (GitHub)</a>
5959
{%- endif %}
6060
</nav>
6161
{%- endif %}

peps/pep-0007.rst

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,24 @@ particular rule:
2626
clean up someone else's mess (in true XP style).
2727

2828

29-
C dialect
30-
=========
29+
.. _c_dialect:
30+
31+
C standards
32+
===========
33+
34+
Follow the following standards.
35+
For features that aren't in the relevant standard, use CPython-specific
36+
wrappers (for example: ``_Py_atomic_store_int32``, ``Py_ALWAYS_INLINE``,
37+
``Py_ARITHMETIC_RIGHT_SHIFT``; ``_Py_ALIGNED_DEF`` in public headers).
38+
When adding such wrappers, try to make them easy to adjust for unsupported
39+
compilers.
3140

3241
* Python 3.11 and newer versions use C11 without `optional features
33-
<https://en.wikipedia.org/wiki/C11_%28C_standard_revision%29#Optional_features>`_.
34-
The public C API should be compatible with C++.
42+
<https://en.wikipedia.org/wiki/C11_%28C_standard_revision%29#Optional_features>`__.
43+
The public C API should be compatible with C99 and C++.
44+
45+
(As a reminder to any users reading this: this PEP is a *style guide*; these
46+
rules are there to be broken.)
3547

3648
* Python 3.6 to 3.10 use C89 with several select C99 features:
3749

@@ -44,15 +56,19 @@ C dialect
4456
- C++-style line comments
4557

4658
* Python versions before 3.6 used ANSI/ISO standard C (the 1989 version
47-
of the standard). This meant (amongst many other things) that all
48-
declarations must be at the top of a block (not necessarily at the
49-
top of function).
59+
of the standard). This meant, amongst many other things, that all
60+
declarations were at the top of a block.
61+
62+
63+
Common C code conventions
64+
=========================
5065

51-
* Don't use compiler-specific extensions, such as those of GCC or MSVC
52-
(e.g. don't write multi-line strings without trailing backslashes).
66+
* Don't use compiler-specific extensions, such as those of GCC or MSVC.
67+
For example, don't write multi-line strings without trailing backslashes.
5368

54-
* All function declarations and definitions must use full prototypes
55-
(i.e. specify the types of all arguments).
69+
* All function declarations and definitions must use full prototypes.
70+
That is, specify the types of all arguments and use ``(void)`` to declare
71+
functions with no arguments.
5672

5773
* No compiler warnings with major compilers (gcc, VC++, a few others).
5874

peps/pep-0011.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ aarch64-apple-darwin clang
8383
aarch64-unknown-linux-gnu glibc, gcc
8484
i686-pc-windows-msvc
8585
x86_64-pc-windows-msvc
86-
x86_64-apple-darwin BSD libc, clang
8786
x86_64-unknown-linux-gnu glibc, gcc
8887
========================= =====
8988

@@ -103,6 +102,7 @@ Target Triple Notes Contacts
103102
============================= ========================== ========
104103
aarch64-unknown-linux-gnu glibc, clang Victor Stinner, Gregory P. Smith
105104
wasm32-unknown-wasip1 WASI SDK, Wasmtime Brett Cannon, Michael Droettboom
105+
x86_64-apple-darwin macOS, clang Sam Gross, Barry Warsaw, Ronald Oussoren
106106
x86_64-unknown-linux-gnu glibc, clang Victor Stinner, Gregory P. Smith
107107
============================= ========================== ========
108108

@@ -123,7 +123,7 @@ aarch64-linux-android Russell Keith-Magee
123123
aarch64-pc-windows-msvc Steve Dower
124124
arm64-apple-ios iOS on device Russell Keith-Magee, Ned Deily
125125
arm64-apple-ios-simulator iOS on M1 macOS simulator Russell Keith-Magee, Ned Deily
126-
armv7l-unknown-linux-gnueabihf Raspberry Pi OS, glibc, gcc Gregory P. Smith
126+
armv7l-unknown-linux-gnueabihf 32-bit Raspberry Pi OS, gcc Gregory P. Smith
127127
powerpc64le-unknown-linux-gnu glibc, clang Victor Stinner
128128

129129
glibc, gcc Victor Stinner

peps/pep-0351.rst

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ It is conceivable that third party objects also have similar mutable
3838
and immutable counterparts, and it would be useful to have a standard
3939
protocol for conversion of such objects.
4040

41-
sets.Set objects expose a "protocol for automatic conversion to
42-
immutable" so that you can create sets.Sets of sets.Sets. :pep:`218`
41+
``sets.Set`` objects expose a "protocol for automatic conversion to
42+
immutable" so that you can create ``sets.Set``'s of ``sets.Set``'s. :pep:`218`
4343
deliberately dropped this feature from built-in sets. This PEP
4444
advances that the feature is still useful and proposes a standard
4545
mechanism for its support.
@@ -48,22 +48,24 @@ mechanism for its support.
4848
Proposal
4949
========
5050

51-
It is proposed that a new built-in function called freeze() is added.
51+
It is proposed that a new built-in function called ``freeze()`` is added.
5252

53-
If freeze() is passed an immutable object, as determined by hash() on
54-
that object not raising a TypeError, then the object is returned
53+
If ``freeze()`` is passed an immutable object, as determined by ``hash()`` on
54+
that object not raising a ``TypeError``, then the object is returned
5555
directly.
5656

57-
If freeze() is passed a mutable object (i.e. hash() of that object
58-
raises a TypeError), then freeze() will call that object's
59-
__freeze__() method to get an immutable copy. If the object does not
60-
have a __freeze__() method, then a TypeError is raised.
57+
If ``freeze()`` is passed a mutable object (i.e. ``hash()`` of that object
58+
raises a ``TypeError``), then ``freeze()`` will call that object's
59+
``__freeze__()`` method to get an immutable copy. If the object does not
60+
have a ``__freeze__()`` method, then a ``TypeError`` is raised.
6161

6262

6363
Sample implementations
6464
======================
6565

66-
Here is a Python implementation of the freeze() built-in::
66+
Here is a Python implementation of the ``freeze()`` built-in:
67+
68+
.. code-block:: python
6769
6870
def freeze(obj):
6971
try:
@@ -73,9 +75,11 @@ Here is a Python implementation of the freeze() built-in::
7375
freezer = getattr(obj, '__freeze__', None)
7476
if freezer:
7577
return freezer()
76-
raise TypeError('object is not freezable')``
78+
raise TypeError('object is not freezable')
79+
80+
Here are some code samples which show the intended semantics:
7781

78-
Here are some code samples which show the intended semantics::
82+
.. code-block:: python
7983
8084
class xset(set):
8185
def __freeze__(self):
@@ -104,6 +108,8 @@ Here are some code samples which show the intended semantics::
104108
def __freeze__(self):
105109
return imdict(self)
106110
111+
.. code-block:: python-console
112+
107113
>>> s = set([1, 2, 3])
108114
>>> {s: 4}
109115
Traceback (most recent call last):
@@ -140,9 +146,9 @@ Reference implementation
140146
========================
141147

142148
Patch 1335812_ provides the C implementation of this feature. It adds the
143-
freeze() built-in, along with implementations of the __freeze__()
149+
``freeze()`` built-in, along with implementations of the ``__freeze__()``
144150
method for lists and sets. Dictionaries are not easily freezable in
145-
current Python, so an implementation of dict.__freeze__() is not
151+
current Python, so an implementation of ``dict.__freeze__()`` is not
146152
provided yet.
147153

148154
.. _1335812: http://sourceforge.net/tracker/index.php?func=detail&aid=1335812&group_id=5470&atid=305470
@@ -155,11 +161,11 @@ Open issues
155161
- Should dicts and sets automatically freeze their mutable keys?
156162

157163
- Should we support "temporary freezing" (perhaps with a method called
158-
__congeal__()) a la __as_temporarily_immutable__() in sets.Set?
164+
``__congeal__()``) a la ``__as_temporarily_immutable__()`` in ``sets.Set``?
159165

160-
- For backward compatibility with sets.Set, should we support
161-
__as_immutable__()? Or should __freeze__() just be renamed to
162-
__as_immutable__()?
166+
- For backward compatibility with ``sets.Set``, should we support
167+
``__as_immutable__()``? Or should ``__freeze__()`` just be renamed to
168+
``__as_immutable__()``?
163169

164170

165171
Copyright

peps/pep-0387.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ References
219219

220220
.. [#tiobe] TIOBE Programming Community Index
221221
222-
http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
222+
https://www.tiobe.com/tiobe-index/
223223
224224
.. [#warnings] The warnings module
225225

0 commit comments

Comments
 (0)