Skip to content

Commit 977ece0

Browse files
committed
Merge branch 'master' into cached-property
* master: (107 commits) bpo-22057: Clarify eval() documentation (pythonGH-8812) bpo-34318: Convert deprecation warnings to errors in assertRaises() etc. (pythonGH-8623) bpo-22602: Raise an exception in the UTF-7 decoder for ill-formed sequences starting with "+". (pythonGH-8741) bpo-34415: Updated logging.Formatter docstring. (pythonGH-8811) bpo-34432: doc Mention complex and decimal.Decimal on str.format not about locales (pythonGH-8808) bpo-34381: refer to 'Running & Writing Tests' in README.rst (pythonGH-8797) Improve error message when mock.assert_has_calls fails (pythonGH-8205) Warn not to set SIGPIPE to SIG_DFL (python#6773) bpo-34419: selectmodule.c does not compile on HP-UX due to bpo-31938 (pythonGH-8796) bpo-34418: Fix HTTPErrorProcessor documentation (pythonGH-8793) bpo-34391: Fix ftplib test for TLS 1.3 (pythonGH-8787) bpo-34217: Use lowercase for windows headers (pythonGH-8472) bpo-34395: Fix memory leaks caused by incautious usage of PyMem_Resize(). (pythonGH-8756) bpo-34405: Updated to OpenSSL 1.1.0i for Windows builds. (pythonGH-8775) bpo-34384: Fix os.readlink() on Windows (pythonGH-8740) closes bpo-34400: Fix undefined behavior in parsetok(). (pythonGH-4439) bpo-34399: 2048 bits RSA keys and DH params (python#8762) Make regular expressions in test_tasks.py raw strings. (pythonGH-8759) smtplib documentation fixes (pythonGH-8708) Fix misindented yaml in logging how to example (pythonGH-8604) ...
2 parents b504a20 + 225b055 commit 977ece0

File tree

232 files changed

+4485
-2766
lines changed

Some content is hidden

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

232 files changed

+4485
-2766
lines changed

.vsts/docs.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,35 @@ steps:
2323
clean: true
2424
fetchDepth: 5
2525

26+
- script: |
27+
git fetch -q origin $(system.pullRequest.targetBranch)
28+
if ! git diff --name-only HEAD $(git merge-base HEAD FETCH_HEAD) | grep -qE '(\.rst$|^Doc|^Misc)'
29+
then
30+
echo "No docs were updated, stopping build process."
31+
echo "##vso[task.setvariable variable=NoDocs]true"
32+
exit
33+
fi
34+
displayName: Detect doc-only changes
35+
condition: and(succeeded(), variables['system.pullRequest.targetBranch'])
36+
2637
- task: UsePythonVersion@0
2738
displayName: 'Use Python 3.6 or later'
2839
inputs:
2940
versionSpec: '>=3.6'
41+
condition: and(succeeded(), ne(variables['NoDocs'], 'true'))
3042

3143
- script: python -m pip install sphinx~=1.6.1 blurb python-docs-theme
3244
displayName: 'Install build dependencies'
45+
condition: and(succeeded(), ne(variables['NoDocs'], 'true'))
3346

3447
- script: make check suspicious html PYTHON=python
3548
workingDirectory: '$(build.sourcesDirectory)/Doc'
3649
displayName: 'Build documentation'
50+
condition: and(succeeded(), ne(variables['NoDocs'], 'true'))
3751

3852
- task: PublishBuildArtifacts@1
3953
displayName: 'Publish build'
40-
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
54+
condition: and(and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')), ne(variables['NoDocs'], 'true'))
4155
inputs:
4256
PathToPublish: '$(build.sourcesDirectory)/Doc/build'
4357
ArtifactName: build

.vsts/linux-coverage.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,24 @@ steps:
2727
clean: true
2828
fetchDepth: 5
2929

30+
- script: |
31+
git fetch -q origin $(system.pullRequest.targetBranch)
32+
if ! git diff --name-only HEAD $(git merge-base HEAD FETCH_HEAD) | grep -qvE '(\.rst$|^Doc|^Misc)'
33+
then
34+
echo "Only docs were updated, stopping build process."
35+
echo "##vso[task.setvariable variable=DocOnly]true"
36+
exit
37+
fi
38+
displayName: Detect doc-only changes
39+
condition: and(succeeded(), variables['system.pullRequest.targetBranch'])
40+
3041
#- template: linux-deps.yml
3142

3243
# See https://github.com/Microsoft/vsts-agent/blob/master/docs/preview/yamlgettingstarted-templates.md
3344
# For now, we copy/paste the steps
3445
- script: echo "deb-src http://archive.ubuntu.com/ubuntu/ xenial main" > /etc/apt/sources.list.d/python.list && sudo apt-get update
3546
displayName: 'Update apt-get lists'
47+
condition: and(succeeded(), ne(variables['DocOnly'], 'true'))
3648

3749
- script: echo ##vso[task.prependpath]$(OPENSSL_DIR)
3850
displayName: 'Add $(OPENSSL_DIR) to PATH'
@@ -55,24 +67,32 @@ steps:
5567
uuid-dev
5668
xvfb
5769
displayName: 'Install dependencies'
70+
condition: and(succeeded(), ne(variables['DocOnly'], 'true'))
5871
- script: python3 Tools/ssl/multissltests.py --steps=library --base-directory $(build.sourcesDirectory)/multissl --openssl $(OPENSSL) --system Linux
5972
displayName: 'python multissltests.py'
73+
condition: and(succeeded(), ne(variables['DocOnly'], 'true'))
6074

6175

6276
- script: ./configure --with-pydebug
6377
displayName: 'Configure CPython (debug)'
78+
condition: and(succeeded(), ne(variables['DocOnly'], 'true'))
6479

6580
- script: make -s -j4
6681
displayName: 'Build CPython'
82+
condition: and(succeeded(), ne(variables['DocOnly'], 'true'))
6783

6884
- script: ./python -m venv venv && ./venv/bin/python -m pip install -U coverage
6985
displayName: 'Set up virtual environment'
86+
condition: and(succeeded(), ne(variables['DocOnly'], 'true'))
7087

7188
- script: ./venv/bin/python -m test.pythoninfo
7289
displayName: 'Display build info'
90+
condition: and(succeeded(), ne(variables['DocOnly'], 'true'))
7391

7492
- script: xvfb-run ./venv/bin/python -m coverage run --pylib -m test --fail-env-changed -uall,-cpu -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_multiprocessing_spawn -x test_concurrent_futures
7593
displayName: 'Tests with coverage'
94+
condition: and(succeeded(), ne(variables['DocOnly'], 'true'))
7695

7796
- script: source ./venv/bin/activate && bash <(curl -s https://codecov.io/bash)
7897
displayName: 'Publish code coverage results'
98+
condition: and(succeeded(), ne(variables['DocOnly'], 'true'))

.vsts/linux-pr.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,29 @@ steps:
2727
clean: true
2828
fetchDepth: 5
2929

30+
- script: |
31+
git fetch -q origin $(system.pullRequest.targetBranch)
32+
if ! git diff --name-only HEAD $(git merge-base HEAD FETCH_HEAD) | grep -qvE '(\.rst$|^Doc|^Misc)'
33+
then
34+
echo "Only docs were updated, stopping build process."
35+
echo "##vso[task.setvariable variable=DocOnly]true"
36+
exit
37+
fi
38+
displayName: Detect doc-only changes
39+
condition: and(succeeded(), variables['system.pullRequest.targetBranch'])
40+
3041
#- template: linux-deps.yml
3142

3243
# See https://github.com/Microsoft/vsts-agent/blob/master/docs/preview/yamlgettingstarted-templates.md
3344
# For now, we copy/paste the steps
3445
- script: echo "deb-src http://archive.ubuntu.com/ubuntu/ xenial main" > /etc/apt/sources.list.d/python.list && sudo apt-get update
3546
displayName: 'Update apt-get lists'
47+
condition: and(succeeded(), ne(variables['DocOnly'], 'true'))
3648

3749
- script: echo ##vso[task.prependpath]$(OPENSSL_DIR)
3850
displayName: 'Add $(OPENSSL_DIR) to PATH'
51+
condition: and(succeeded(), ne(variables['DocOnly'], 'true'))
52+
3953
- script: >
4054
sudo apt-get -yq install
4155
build-essential
@@ -55,22 +69,30 @@ steps:
5569
uuid-dev
5670
xvfb
5771
displayName: 'Install dependencies'
72+
condition: and(succeeded(), ne(variables['DocOnly'], 'true'))
73+
5874
- script: python3 Tools/ssl/multissltests.py --steps=library --base-directory $(build.sourcesDirectory)/multissl --openssl $(OPENSSL) --system Linux
5975
displayName: 'python multissltests.py'
76+
condition: and(succeeded(), ne(variables['DocOnly'], 'true'))
6077

6178

6279
- script: ./configure --with-pydebug
6380
displayName: 'Configure CPython (debug)'
81+
condition: and(succeeded(), ne(variables['DocOnly'], 'true'))
6482

6583
- script: make -s -j4
6684
displayName: 'Build CPython'
85+
condition: and(succeeded(), ne(variables['DocOnly'], 'true'))
6786

6887
- script: make pythoninfo
6988
displayName: 'Display build info'
89+
condition: and(succeeded(), ne(variables['DocOnly'], 'true'))
7090

7191
# Run patchcheck and fail if anything is discovered
7292
- script: ./python Tools/scripts/patchcheck.py --travis true
7393
displayName: 'Run patchcheck.py'
94+
condition: and(succeeded(), ne(variables['DocOnly'], 'true'))
7495

7596
- script: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
7697
displayName: 'Tests'
98+
condition: and(succeeded(), ne(variables['DocOnly'], 'true'))

.vsts/macos-pr.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,32 @@ steps:
2424
clean: true
2525
fetchDepth: 5
2626

27+
- script: |
28+
git fetch -q origin $(system.pullRequest.targetBranch)
29+
changes = $(git diff --name-only HEAD $(git merge-base HEAD FETCH_HEAD))
30+
echo "Files changed:"
31+
echo "$changes"
32+
if ! echo "$changes" | grep -qvE '(\.rst$)|(^Doc)|(^Misc)'
33+
then
34+
echo "Only docs were updated, stopping build process."
35+
echo "##vso[task.setvariable variable=DocOnly]true"
36+
exit
37+
fi
38+
displayName: Detect doc-only changes
39+
condition: and(succeeded(), variables['system.pullRequest.targetBranch'])
40+
2741
- script: ./configure --with-pydebug --with-openssl=/usr/local/opt/openssl --prefix=/opt/python-vsts
2842
displayName: 'Configure CPython (debug)'
43+
condition: and(succeeded(), ne(variables['DocOnly'], 'true'))
2944

3045
- script: make -s -j4
3146
displayName: 'Build CPython'
47+
condition: and(succeeded(), ne(variables['DocOnly'], 'true'))
3248

3349
- script: make pythoninfo
3450
displayName: 'Display build info'
51+
condition: and(succeeded(), ne(variables['DocOnly'], 'true'))
3552

3653
- script: make buildbottest TESTOPTS="-j4 -uall,-cpu"
3754
displayName: 'Tests'
55+
condition: and(succeeded(), ne(variables['DocOnly'], 'true'))

.vsts/windows-pr.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,25 @@ steps:
3737
clean: true
3838
fetchDepth: 5
3939

40+
- powershell: |
41+
git fetch -q origin $(System.PullRequest.TargetBranch)
42+
if (-not (git diff --name-only HEAD (git merge-base HEAD FETCH_HEAD) | sls -NotMatch '(\.rst$)|(^Doc)|(^Misc)')) {
43+
Write-Host 'Only docs were updated. Skipping build'
44+
Write-Host '##vso[task.setvariable variable=DocOnly]true'
45+
}
46+
displayName: Detect doc-only changes
47+
condition: and(succeeded(), variables['System.PullRequest.TargetBranch'])
48+
4049
- script: PCbuild\build.bat -e $(buildOpt)
4150
displayName: 'Build CPython'
51+
condition: and(succeeded(), ne(variables['DocOnly'], 'true'))
4252

4353
- script: python.bat -m test.pythoninfo
4454
displayName: 'Display build info'
55+
condition: and(succeeded(), ne(variables['DocOnly'], 'true'))
4556

4657
- script: PCbuild\rt.bat -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
4758
displayName: 'Tests'
4859
env:
4960
PREFIX: $(Py_OutDir)\$(outDirSuffix)
61+
condition: and(succeeded(), ne(variables['DocOnly'], 'true'))

Doc/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ To get started on UNIX, you can create a virtual environment with the command ::
3333
make venv
3434

3535
That will install all the tools necessary to build the documentation. Assuming
36-
the virtual environment was created in the ``env`` directory (the default;
36+
the virtual environment was created in the ``venv`` directory (the default;
3737
configurable with the VENVDIR variable), you can run the following command to
3838
build the HTML output files::
3939

Doc/faq/design.rst

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -215,24 +215,25 @@ objects using the ``for`` statement. For example, :term:`file objects
215215
Why does Python use methods for some functionality (e.g. list.index()) but functions for other (e.g. len(list))?
216216
----------------------------------------------------------------------------------------------------------------
217217

218-
The major reason is history. Functions were used for those operations that were
219-
generic for a group of types and which were intended to work even for objects
220-
that didn't have methods at all (e.g. tuples). It is also convenient to have a
221-
function that can readily be applied to an amorphous collection of objects when
222-
you use the functional features of Python (``map()``, ``zip()`` et al).
223-
224-
In fact, implementing ``len()``, ``max()``, ``min()`` as a built-in function is
225-
actually less code than implementing them as methods for each type. One can
226-
quibble about individual cases but it's a part of Python, and it's too late to
227-
make such fundamental changes now. The functions have to remain to avoid massive
228-
code breakage.
229-
230-
.. XXX talk about protocols?
231-
232-
.. note::
233-
234-
For string operations, Python has moved from external functions (the
235-
``string`` module) to methods. However, ``len()`` is still a function.
218+
As Guido said:
219+
220+
(a) For some operations, prefix notation just reads better than
221+
postfix -- prefix (and infix!) operations have a long tradition in
222+
mathematics which likes notations where the visuals help the
223+
mathematician thinking about a problem. Compare the easy with which we
224+
rewrite a formula like x*(a+b) into x*a + x*b to the clumsiness of
225+
doing the same thing using a raw OO notation.
226+
227+
(b) When I read code that says len(x) I *know* that it is asking for
228+
the length of something. This tells me two things: the result is an
229+
integer, and the argument is some kind of container. To the contrary,
230+
when I read x.len(), I have to already know that x is some kind of
231+
container implementing an interface or inheriting from a class that
232+
has a standard len(). Witness the confusion we occasionally have when
233+
a class that is not implementing a mapping has a get() or keys()
234+
method, or something that isn't a file has a write() method.
235+
236+
-- https://mail.python.org/pipermail/python-3000/2006-November/004643.html
236237

237238

238239
Why is join() a string method instead of a list or tuple method?

Doc/glossary.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ Glossary
123123
:meth:`__aiter__` method. Introduced by :pep:`492`.
124124

125125
asynchronous iterator
126-
An object that implements :meth:`__aiter__` and :meth:`__anext__`
126+
An object that implements the :meth:`__aiter__` and :meth:`__anext__`
127127
methods. ``__anext__`` must return an :term:`awaitable` object.
128-
:keyword:`async for` resolves awaitable returned from asynchronous
129-
iterator's :meth:`__anext__` method until it raises
128+
:keyword:`async for` resolves the awaitables returned by an asynchronous
129+
iterator's :meth:`__anext__` method until it raises a
130130
:exc:`StopAsyncIteration` exception. Introduced by :pep:`492`.
131131

132132
attribute

0 commit comments

Comments
 (0)