Skip to content

Commit 5d0abf8

Browse files
committed
Merge from upstream CPython devguide
Conflicts resolved manually in documenting.rst, index.rst and pullrequest.rst
2 parents b1451ec + ae7636c commit 5d0abf8

20 files changed

+477
-355
lines changed

.github/CODE_OF_CONDUCT.rst

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
:orphan:
2+
3+
Code of Conduct
4+
===============
5+
6+
Please note that all interactions on
7+
`Python Software Foundation <https://www.python.org/psf-landing/>`__-supported
8+
infrastructure is `covered
9+
<https://www.python.org/psf/records/board/minutes/2014-01-06/#management-of-the-psfs-web-properties>`__
10+
by the `PSF Code of Conduct <https://www.python.org/psf/codeofconduct/>`__,
11+
which includes all infrastructure used in the development of Python itself
12+
(e.g. mailing lists, issue trackers, GitHub, etc.).
13+
14+
In general this means everyone is expected to be open, considerate, and
15+
respectful of others no matter what their position is within the project.

buildbots.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Continuous Integration
44
======================
55

66
To assert that there are no regressions in the :doc:`development and maintenance
7-
branches <devcycle>`, Python has a set of dedicated machines (called *buildbots* or
8-
*build slaves*) used for continuous integration. They span a number of
7+
branches <devcycle>`, Python has a set of dedicated machines (called *buildbots*
8+
or *build slaves*) used for continuous integration. They span a number of
99
hardware/operating system combinations. Furthermore, each machine hosts
1010
several *builders*, one per active branch: when a new change is pushed
1111
to this branch on the public Mercurial repository, all corresponding builders
@@ -38,7 +38,7 @@ There are three ways of visualizing recent build results:
3838
https://code.google.com/archive/p/bbreport. Installing it is trivial: just add
3939
the directory containing ``bbreport.py`` to your system path so that
4040
you can run it from any filesystem location. For example, if you want
41-
to display the latest build results on the development ("default") branch,
41+
to display the latest build results on the development ("master") branch,
4242
type::
4343

4444
bbreport.py -q 3.x
@@ -186,8 +186,8 @@ offenders:
186186
When you think a failure might be transient, it is recommended you confirm by
187187
waiting for the next build. Still, even if the failure does turn out sporadic
188188
and unpredictable, the issue should be reported on the bug tracker; even
189-
better if it can be diagnosed and suppressed by fixing the test's implementation,
190-
or by making its parameters - such as a timeout - more robust.
189+
better if it can be diagnosed and suppressed by fixing the test's
190+
implementation, or by making its parameters - such as a timeout - more robust.
191191

192192

193193
Custom builders

committing.rst

+24-95
Original file line numberDiff line numberDiff line change
@@ -64,54 +64,8 @@ passes before merging any code changes.
6464
Patch checklist
6565
'''''''''''''''
6666

67-
Along with running the tests, a simple automated patch checklist, ``patchcheck``,
68-
guides a developer through the common patch generation checks. To run
69-
``patchcheck``:
70-
71-
On *UNIX* (including Mac OS X)::
72-
73-
make patchcheck
74-
75-
On *Windows* (after any successful build)::
76-
77-
python.bat Tools/scripts/patchcheck.py
78-
79-
The automated patch checklist runs through:
80-
81-
* Are there any whitespace problems in Python files?
82-
(using ``Tools/scripts/reindent.py``)
83-
* Are there any whitespace problems in C files?
84-
* Are there any whitespace problems in the documentation?
85-
(using ``Tools/scripts/reindent-rst.py``)
86-
* Has the documentation been updated?
87-
* Has the test suite been updated?
88-
* Has an entry under ``Misc/NEWS.d/next`` been added?
89-
* Has ``Misc/ACKS`` been updated?
90-
* Has ``configure`` been regenerated, if necessary?
91-
* Has ``pyconfig.h.in`` been regenerated, if necessary?
92-
93-
The automated patch check doesn't actually *answer* all of these
94-
questions. Aside from the whitespace checks, the tool is
95-
a memory aid for the various elements that can go into
96-
making a complete patch.
97-
98-
99-
Commit Style
100-
------------
101-
102-
.. move this to pullrequest
103-
104-
Once a change patch is ready and tested, it can be committed to the repository.
105-
We usually prefer to put a whole feature or bugfix into a single commit, but no
106-
more. In particular:
107-
108-
* Do **not** fix more than one issue in the same commit (except, of course, if
109-
one code change fixes all of them).
110-
* Do **not** do cosmetic changes to unrelated code in the same commit as some
111-
feature/bugfix.
112-
113-
It is of course okay to pile up several commits to one branch and merge them
114-
into another in one commit.
67+
You should also :ref:`run patchcheck <patchcheck>` to perform a quick
68+
sanity check on the changes.
11569

11670

11771
Handling Others' Code
@@ -245,39 +199,8 @@ allowed here because news entries are meant to be as readable as possible
245199
unprocessed.)
246200

247201

248-
Commit Messages
249-
---------------
250-
251-
.. move to pullrequest
252-
253-
Every commit has a commit message to document why a change was made and to
254-
communicate that reason to other core developers. Python core developers have
255-
developed a standard way of formatting commit messages that everyone is
256-
expected to follow.
257-
258-
Our usual convention mimics that used in news entries (it is actually common to
259-
start by pasting the news entry into the commit message). The only key
260-
difference when compared to a news entry is the inclusion of the issue number
261-
as the beginning of the commit message. Here is an example::
262-
263-
bpo-42: the spam module is now more spammy.
264-
265-
The spam module sporadically came up short on spam. This change
266-
raises the amount of spam in the module by making it more spammy.
267-
268-
Thanks to Monty Python for the patch.
269-
270-
The first line or sentence is meant to be a dense, to-the-point explanation
271-
of what the purpose of the commit is. If this is not enough detail for a commit,
272-
a new paragraph(s) can be added to explain in proper depth what has happened
273-
(detail should be good enough that a core developer reading the commit message
274-
understands the justification for the change). Also, if a non-core developer
275-
contributed to the resolution, it is good practice to credit them.
276-
277-
278-
279202
Working with Git_
280-
=================
203+
-----------------
281204

282205
.. seealso::
283206
:ref:`gitbootcamp`
@@ -291,13 +214,17 @@ repositories means you have to be more careful with your workflow:
291214
dedicated to maintenance of the work before the work gets integrated in the
292215
main repository.
293216

217+
An exception to this rule: you can make a quick edit through the web UI of
218+
GitHub, in which case the branch you create can exist for less than 24 hours.
219+
This exception should not be abused and be left only for very simple changes.
220+
294221
* You should not commit directly into the ``master`` branch, or any of the
295-
maintenance branches (``2.7``, ``3.5``, or ``3.6``). You should commit against
296-
your own feature branch, and create a pull request.
222+
maintenance branches (currently ``2.7`` or ``3.6``).
223+
You should commit against your own feature branch, and create a pull request.
297224

298-
It is recommended to keep a fork of the main repository around, as it allows simple
299-
reversion of all local changes (even "committed" ones) if your local clone gets
300-
into a state you aren't happy with.
225+
It is recommended to keep a fork of the main repository around, as it allows
226+
simple reversion of all local changes (even "committed" ones) if your local
227+
clone gets into a state you aren't happy with.
301228

302229

303230
.. _Git: https://git-scm.com/
@@ -306,7 +233,7 @@ into a state you aren't happy with.
306233
.. _committing-active-branches:
307234

308235
Active branches
309-
---------------
236+
'''''''''''''''
310237

311238
If you do ``git branch`` you will see a :ref:`list of branches <listbranch>`.
312239
``master`` is the in-development branch, and is the only branch that receives
@@ -316,17 +243,19 @@ new features. The other branches only receive bug fixes or security fixes.
316243
.. _branch-merge:
317244

318245
Backporting Changes to an Older Version
319-
---------------------------------------
246+
'''''''''''''''''''''''''''''''''''''''
320247

321-
When it is determined that a pull request needs to be backported into one or more of
322-
the maintenance branches, a core developer can apply the labels ``needs backport to X.Y``
323-
to the pull request.
248+
When it is determined that a pull request needs to be backported into one or
249+
more of the maintenance branches, a core developer can apply the labels
250+
``needs backport to X.Y`` to the pull request.
324251

325-
After the pull request has been merged, it can be backported using cherry_picker.py_.
252+
After the pull request has been merged, it can be backported using
253+
cherry_picker.py_.
326254

327-
The commit hash can be obtained from the original pull request, or by using `git log`
328-
on the ``master`` branch. To display the 10 most recent commit hashes and their first
329-
line of the commit message::
255+
The commit hash can be obtained from the original pull request, or by using
256+
``git log`` on the ``master`` branch.
257+
To display the 10 most recent commit hashes and their first line of the commit
258+
message::
330259

331260
git log -10 --oneline
332261

@@ -344,7 +273,7 @@ Developers can apply labels to GitHub pull requests).
344273

345274

346275
Reverting a Merged Pull Request
347-
-------------------------------
276+
'''''''''''''''''''''''''''''''
348277

349278
To revert a merged pull request, press the ``Revert`` button at the bottom of
350279
the pull request. It will bring up the page to create a new pull request where

communication.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ Python-ideas_ is a mailing list open to the public to discuss ideas on changing
4949
Python. If a new idea does not start here (or python-list_, discussed below),
5050
it will get redirected here.
5151

52-
Sometimes people post new ideas to python-list_ to gather community opinion before
53-
heading to python-ideas_. The list is also sometimes known as comp.lang.python,
54-
the name of the newsgroup it mirrors (it is also known by the abbreviation
55-
c.l.py).
52+
Sometimes people post new ideas to python-list_ to gather community opinion
53+
before heading to python-ideas_. The list is also sometimes known as
54+
comp.lang.python, the name of the newsgroup it mirrors (it is also known by
55+
the abbreviation c.l.py).
5656

5757
The python-committers_ mailing list is a private mailing list for core
5858
developers (the archives are publicly available).

compiler.rst

+20-19
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@ approach and syntax::
9797
{
9898
stmt = FunctionDef(identifier name, arguments args, stmt* body,
9999
expr* decorators)
100-
| Return(expr? value) | Yield(expr value)
100+
| Return(expr? value) | Yield(expr? value)
101101
attributes (int lineno)
102102
}
103103

104-
The preceding example describes three different kinds of statements;
105-
function definitions, return statements, and yield statements. All
106-
three kinds are considered of type ``stmt`` as shown by ``|`` separating the
107-
various kinds. They all take arguments of various kinds and amounts.
104+
The preceding example describes two different kinds of statements and an
105+
expression: function definitions, return statements, and yield expressions.
106+
All three kinds are considered of type ``stmt`` as shown by ``|`` separating
107+
the various kinds. They all take arguments of various kinds and amounts.
108108

109109
Modifiers on the argument type specify the number of values needed; ``?``
110110
means it is optional, ``*`` means 0 or more, while no modifier means only one
@@ -170,11 +170,11 @@ very beginning of the compiler or the end, you need to care about how the arena
170170
works. All code relating to the arena is in either :file:`Include/pyarena.h` or
171171
:file:`Python/pyarena.c`.
172172

173-
``PyArena_New()`` will create a new arena. The returned ``PyArena`` structure will
174-
store pointers to all memory given to it. This does the bookkeeping of what
175-
memory needs to be freed when the compiler is finished with the memory it used.
176-
That freeing is done with ``PyArena_Free()``. This only needs to be called in
177-
strategic areas where the compiler exits.
173+
``PyArena_New()`` will create a new arena. The returned ``PyArena`` structure
174+
will store pointers to all memory given to it. This does the bookkeeping of
175+
what memory needs to be freed when the compiler is finished with the memory it
176+
used. That freeing is done with ``PyArena_Free()``. This only needs to be
177+
called in strategic areas where the compiler exits.
178178

179179
As stated above, in general you should not have to worry about memory
180180
management when working on the compiler. The technical details have been
@@ -367,23 +367,24 @@ bytecode step of the compiler. Several pieces of code throughout Python depend
367367
on having correct information about what bytecode exists.
368368

369369
First, you must choose a name and a unique identifier number. The official
370-
list of bytecode can be found in :file:`Include/opcode.h`. If the opcode is to take
371-
an argument, it must be given a unique number greater than that assigned to
370+
list of bytecode can be found in :file:`Include/opcode.h`. If the opcode is to
371+
take an argument, it must be given a unique number greater than that assigned to
372372
``HAVE_ARGUMENT`` (as found in :file:`Include/opcode.h`).
373373

374374
Once the name/number pair has been chosen and entered in Include/opcode.h,
375375
you must also enter it into :file:`Lib/opcode.py` and
376376
:file:`Doc/library/dis.rst`.
377377

378378
With a new bytecode you must also change what is called the magic number for
379-
.pyc files. The variable ``MAGIC`` in :file:`Python/import.c` contains the number.
379+
.pyc files. The variable ``MAGIC`` in :file:`Python/import.c` contains the
380+
number.
380381
Changing this number will lead to all .pyc files with the old ``MAGIC``
381382
to be recompiled by the interpreter on import.
382383

383384
Finally, you need to introduce the use of the new bytecode. Altering
384385
:file:`Python/compile.c` and :file:`Python/ceval.c` will be the primary places
385-
to change. But you will also need to change the 'compiler' package. The key files
386-
to do that are :file:`Lib/compiler/pyassem.py` and
386+
to change. But you will also need to change the 'compiler' package.
387+
The key files to do that are :file:`Lib/compiler/pyassem.py` and
387388
:file:`Lib/compiler/pycodegen.py`.
388389

389390
If you make a change here that can affect the output of bytecode that
@@ -392,10 +393,10 @@ sure to delete your old .py(c|o) files! Even though you will end up changing
392393
the magic number if you change the bytecode, while you are debugging your work
393394
you will be changing the bytecode output without constantly bumping up the
394395
magic number. This means you end up with stale .pyc files that will not be
395-
recreated. Running
396-
``find . -name '*.py[co]' -exec rm -f {} ';'`` should delete all .pyc files you
397-
have, forcing new ones to be created and thus allow you test out your new
398-
bytecode properly.
396+
recreated.
397+
Running ``find . -name '*.py[co]' -exec rm -f {} ';'`` should delete all .pyc
398+
files you have, forcing new ones to be created and thus allow you test out your
399+
new bytecode properly.
399400

400401

401402
Code Objects

devcycle.rst

+8-10
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ It is the branch :ref:`checked out <checkout-jy>` by default by Mercurial.
5858

5959
At some point during the life-cycle of a release, a
6060
new :ref:`maintenance branch <maintbranch>` is created to host all bug fixing
61-
activity for further micro versions in a feature version (3.3.1, 3.3.2, etc.).
61+
activity for further micro versions in a feature version (3.6.1, 3.6.2, etc.).
6262

6363
For versions 3.4 and before, this was conventionally done when the final
6464
release was cut (for example, 3.4.0 final).
@@ -122,7 +122,7 @@ security patches have been applied to the branch.
122122
Summary
123123
-------
124124

125-
There are 6 open branches right now in the Git repository:
125+
There are 5 open branches right now in the Git repository:
126126

127127
.. warning:: CPython-specific
128128

@@ -134,8 +134,6 @@ There are 6 open branches right now in the Git repository:
134134
(RM: Larry Hastings)
135135
- the ``3.4`` branch accepts security fixes for future 3.4.x security releases
136136
(RM: Larry Hastings)
137-
- the ``3.3`` branch accepts security fixes for future 3.3.x security releases
138-
(RM: Georg Brandl) [end-of-life for 3.3 is 2017-09-29]
139137
- the ``2.7`` branch accepts bug fixes for future 2.7.x maintenance releases
140138
(RM: Benjamin Peterson)
141139

@@ -186,11 +184,11 @@ bug fixes can now be committed. This is when core developers should concentrate
186184
on the task of fixing regressions and other new issues filed by users who have
187185
downloaded the alpha and beta releases.
188186

189-
Being in beta can be viewed much like being in RC_ but without the extra overhead
190-
of needing commit reviews.
187+
Being in beta can be viewed much like being in RC_ but without the extra
188+
overhead of needing commit reviews.
191189

192-
Please see the note in the `In-development (main) branch`_ section above
193-
for new information about the creation of the 3.5 maintenance branch during beta.
190+
Please see the note in the `In-development (main) branch`_ section above for
191+
new information about the creation of the 3.5 maintenance branch during beta.
194192

195193

196194
.. _rc:
@@ -201,8 +199,8 @@ Release Candidate (RC)
201199
A branch preparing for an RC release can only have bugfixes applied that have
202200
been reviewed by other core developers. Generally, these issues must be
203201
severe enough (e.g. crashes) that they deserve fixing before the final release.
204-
All other issues should be deferred to the next development cycle, since stability
205-
is the strongest concern at this point.
202+
All other issues should be deferred to the next development cycle, since
203+
stability is the strongest concern at this point.
206204

207205
You **cannot** skip the peer review during an RC, no matter how small! Even if
208206
it is a simple copy-and-paste change, **everything** requires peer review from

developers.rst

+6-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ change or granted access. The procedure for adding or removing users is
1414
described in :ref:`altering-access`.
1515

1616
Note, when giving new commit permissions, be sure to get a contributor agreement
17-
from the committer. See https://www.python.org/psf/contrib/ for details. Commit
18-
privileges should not be given until the contributor agreement has been signed
19-
and received.
17+
from the committer. See https://www.python.org/psf/contrib/ for details.
18+
Commit privileges should not be given until the contributor agreement has been
19+
signed and received.
2020

2121
This file is encoded in UTF-8. If the usual form for a name is not in
2222
a Latin or extended Latin alphabet, make sure to include an ASCII
@@ -105,6 +105,9 @@ Permissions History
105105
- Eric Snow was given push privileges on Sep 5 2012 by Antoine Pitrou for
106106
general contributions, on recommendation by Nick Coghlan.
107107

108+
- Jeff Allen was given push privileges on June 13, 2012 by Antoine Pitrou,
109+
at the request of Frank Wierzbicki, for Jython development.
110+
108111
- Peter Moody was given push privileges on May 20 2012 by Antoine Pitrou for
109112
authorship and maintenance of the ipaddress module (accepted in PEP 3144 by
110113
Nick Coghlan).

0 commit comments

Comments
 (0)