Skip to content

Commit d632682

Browse files
Apply suggestions from code review
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
1 parent 66c6a10 commit d632682

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

peps/pep-0795.rst

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ DPO`_ and elsewhere. Based on feedback from DPO this rewrite:
7575
the inclusion of direct sharing across sub-interpreters motivate many
7676
of the design decisions
7777

78-
We are very grateful to the many comments and threads on DPO that have
79-
contributed to this PEP.
8078

8179

8280
Motivation
@@ -161,9 +159,9 @@ only synchronising with its own GIL, they are not synchronising
161159
*with each other*. Sharing an *immutable* object avoids the need
162160
for synchronisation (except for reference counts, which we will
163161
return to later) -- however, if an immutable object has a mutable
164-
sub object, then sharing the immutable object indirectly also
165-
shares the mutable sub objets, which leads to the problems above.
166-
As we cannot prevent the sub object from being accessed, this
162+
sub-object, then sharing the immutable object indirectly also
163+
shares the mutable sub-objects, which leads to the problems above.
164+
As we cannot prevent the sub-object from being accessed, this
167165
motivates *deep* immutability.
168166

169167
The picture below shows the situation above pictorially – the boxes
@@ -620,7 +618,7 @@ pre-freeze hook of the function type object:
620618
2. We freeze the globals copy which freezes the *values* which
621619
are shared between the globals dictionaries, but keeps the
622620
variables in the defining context's globals dictionary mutable.
623-
Thus, ``x = [5, 6, 7]`` is permissable, and because that updates
621+
Thus, ``x = [5, 6, 7]`` is permissible, and because that updates
624622
the sender's ``x`` to point to a mutable object, the subsequent
625623
append is permitted.
626624

@@ -1385,7 +1383,7 @@ A type can become immutable if it satisfies *all* of the constraints below:
13851383
Note the absence of a requirement that all functions defined in the
13861384
class must be able to become immutable. **If a function fails to freeze, it will not be
13871385
possible to call that function on the immutable type.** This alternative is
1388-
preferrable to failing to freeze a type if not all its functions can become
1386+
preferable to failing to freeze a type if not all its functions can become
13891387
immutable and can be used to mimic statically checkable systems where it is
13901388
not possible to call e.g. "non-const methods on const receivers", which will
13911389
be checked dynamically and give a clearer error message than simply a failure
@@ -1878,7 +1876,7 @@ Changes to the C ABI
18781876
This macro is used to check whether the argument (which must be
18791877
castable to ``Py_Object *``) has its immutable bit set. If the
18801878
argument is immutable, this evaluates to ``false``. If the argument
1881-
is writeable, it evalutes to ``true``.
1879+
is writeable, it evaluates to ``true``.
18821880
``Py_IsImmutable(obj)``
18831881
This macro is used to check whether the argument has its immutable
18841882
bit set.
@@ -1976,17 +1974,17 @@ full CPython test suite with the time it takes to run it with our
19761974
changes on-top of it. Because of some intermittent tests failing
19771975
on the CPython baseline, these tests were performed with our
19781976
changes rebased on-top of CPython 3.14 (sha ``754e7c9b``). The
1979-
test suite contained 1109 Python files containing a total of
1980-
627917 LOC. While performance of test code is not
1977+
test suite contained 1,109 Python files containing a total of
1978+
627,917 LOC. While performance of test code is not
19811979
necessarily indicative of performance of production code, the
19821980
breadth and volume of the code gives a good indication of how
1983-
successfull we are in meeting our goal. On average over 10 runs on
1981+
successful we are in meeting our goal. On average over 10 runs on
19841982
a single core to reduce jitter we found that our patch runs the
19851983
tests 1.7% slower on average, which we consider a strong result
19861984
given that we have added a write-barrier and not yet optimised any
1987-
of our code. The Baseline finished in 334.6s +-0.89s; our
1985+
of our code. The baseline finished in 334.6s +-0.89s; our
19881986
build in 340.6s +-1.09s. Our build ran all the passing
1989-
tests of the baseline, supressing one error due to missing
1987+
tests of the baseline, suppressing one error due to missing
19901988
documentation.
19911989

19921990

@@ -1999,7 +1997,7 @@ compared the time required to successfully freeze data structures
19991997
(lists, trees, dictionaries) against the time require to pickle
20001998
and unpickle the same data structures.
20011999

2002-
Our benchmark generates 1000000 strings with eight characters and
2000+
Our benchmark generates 1,000,000 strings with eight characters and
20032001
inserts them into the respective data structures. We have two
20042002
tests for dictionaries, both using random strings as keys, with
20052003
one mapping to integers (dict-int) and the other mapping to
@@ -2268,7 +2266,7 @@ sharing *mutable* objects. We refer to this proposal as “data-race free
22682266
Python” or “DRF Python” for short. In that future proposal, mutable
22692267
objects will only be accessible to one sub-interpreter at a time, but
22702268
can be passed around and shared by reference. We believe that making
2271-
Python data-race free is the right programming model for the langauge,
2269+
Python data-race free is the right programming model for the language,
22722270
and aim to be compatible with both sub-interpreters and free-threaded
22732271
Python.
22742272

@@ -2297,8 +2295,8 @@ Reference implementation
22972295
Our `reference implementation`_, which we have made publicly available on
22982296
Github, implements all of the features described above.
22992297
We steal a bit from the top of the reference count in the object header. In 64-bit
2300-
python this comes from the (currently unused) top word and thus has no impact at
2301-
all on the runtime. In 32-bit python, the second bit of the word is used (since negative
2298+
Python this comes from the (currently unused) top word and thus has no impact at
2299+
all on the runtime. In 32-bit Python, the second bit of the word is used (since negative
23022300
reference counts are used as necessary error conditions. The core functionality
23032301
for immutability is provided in an (internal) ``immutability.h`` header and
23042302
additional ``immutability.c`` file, though the C ABI macros and error function are

0 commit comments

Comments
 (0)