Skip to content

Commit c50bb33

Browse files
Merge branch 'master' into fix-issue24255
* master: (104 commits) Fast path for exact floats in math.hypot() and math.dist() (GH-8949) Remove AIX workaround test_subprocess (GH-8939) bpo-34503: Fix refleak in PyErr_SetObject() (GH-8934) closes bpo-34504: Remove the useless NULL check in PySequence_Check(). (GH-8935) closes bpo-34501: PyType_FromSpecWithBases: Check spec->name before dereferencing it. (GH-8930) closes bpo-34502: Remove a note about utf8_mode from sys.exit() docs. (GH-8928) Remove unneeded PyErr_Clear() in _winapi_SetNamedPipeHandleState_impl() (GH-8281) Fix markup in stdtypes documentation (GH-8905) bpo-34395: Don't free allocated memory on realloc fail in load_mark() in _pickle.c. (GH-8788) Fix upsizing of marks stack in pickle module. (GH-8860) bpo-34171: Prevent creating Lib/trace.cover when run the trace module. (GH-8841) closes bpo-34493: Objects/genobject.c: Add missing NULL check to compute_cr_origin() (GH-8911) Fixed typo with asynccontextmanager code example (GH-8845) bpo-34426: fix typo (__lltrace__ -> __ltrace__) (GH-8822) bpo-13312: Avoid int underflow in time year. (GH-8912) bpo-34492: Python/coreconfig.c: Fix _Py_wstrlist_copy() (GH-8910) bpo-34448: Improve output of usable wchar_t check (GH-8846) closes bpo-34471: _datetime: Add missing NULL check to tzinfo_from_isoformat_results. (GH-8869) bpo-6700: Fix inspect.getsourcelines for module level frames/tracebacks (GH-8864) Fix typo in the dataclasses's doc (GH-8896) ...
2 parents d66ea05 + 74734f7 commit c50bb33

186 files changed

Lines changed: 2178 additions & 975 deletions

File tree

Some content is hidden

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

.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/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

Doc/howto/functional.rst

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ for it.
198198

199199
You can experiment with the iteration interface manually:
200200

201-
>>> L = [1,2,3]
201+
>>> L = [1, 2, 3]
202202
>>> it = iter(L)
203203
>>> it #doctest: +ELLIPSIS
204204
<...iterator object at ...>
@@ -229,7 +229,7 @@ iterator. These two statements are equivalent::
229229
Iterators can be materialized as lists or tuples by using the :func:`list` or
230230
:func:`tuple` constructor functions:
231231

232-
>>> L = [1,2,3]
232+
>>> L = [1, 2, 3]
233233
>>> iterator = iter(L)
234234
>>> t = tuple(iterator)
235235
>>> t
@@ -238,10 +238,10 @@ Iterators can be materialized as lists or tuples by using the :func:`list` or
238238
Sequence unpacking also supports iterators: if you know an iterator will return
239239
N elements, you can unpack them into an N-tuple:
240240

241-
>>> L = [1,2,3]
241+
>>> L = [1, 2, 3]
242242
>>> iterator = iter(L)
243-
>>> a,b,c = iterator
244-
>>> a,b,c
243+
>>> a, b, c = iterator
244+
>>> a, b, c
245245
(1, 2, 3)
246246

247247
Built-in functions such as :func:`max` and :func:`min` can take a single
@@ -411,7 +411,7 @@ lengths of all the sequences. If you have two lists of length 3, the output
411411
list is 9 elements long:
412412

413413
>>> seq1 = 'abc'
414-
>>> seq2 = (1,2,3)
414+
>>> seq2 = (1, 2, 3)
415415
>>> [(x, y) for x in seq1 for y in seq2] #doctest: +NORMALIZE_WHITESPACE
416416
[('a', 1), ('a', 2), ('a', 3),
417417
('b', 1), ('b', 2), ('b', 3),
@@ -479,7 +479,7 @@ Here's a sample usage of the ``generate_ints()`` generator:
479479
File "stdin", line 2, in generate_ints
480480
StopIteration
481481

482-
You could equally write ``for i in generate_ints(5)``, or ``a,b,c =
482+
You could equally write ``for i in generate_ints(5)``, or ``a, b, c =
483483
generate_ints(3)``.
484484

485485
Inside a generator function, ``return value`` causes ``StopIteration(value)``
@@ -695,17 +695,17 @@ truth values of an iterable's contents. :func:`any` returns ``True`` if any ele
695695
in the iterable is a true value, and :func:`all` returns ``True`` if all of the
696696
elements are true values:
697697

698-
>>> any([0,1,0])
698+
>>> any([0, 1, 0])
699699
True
700-
>>> any([0,0,0])
700+
>>> any([0, 0, 0])
701701
False
702-
>>> any([1,1,1])
702+
>>> any([1, 1, 1])
703703
True
704-
>>> all([0,1,0])
704+
>>> all([0, 1, 0])
705705
False
706-
>>> all([0,0,0])
706+
>>> all([0, 0, 0])
707707
False
708-
>>> all([1,1,1])
708+
>>> all([1, 1, 1])
709709
True
710710

711711

@@ -764,7 +764,7 @@ which defaults to 0, and the interval between numbers, which defaults to 1::
764764
a provided iterable and returns a new iterator that returns its elements from
765765
first to last. The new iterator will repeat these elements infinitely. ::
766766

767-
itertools.cycle([1,2,3,4,5]) =>
767+
itertools.cycle([1, 2, 3, 4, 5]) =>
768768
1, 2, 3, 4, 5, 1, 2, 3, 4, 5, ...
769769

770770
:func:`itertools.repeat(elem, [n]) <itertools.repeat>` returns the provided
@@ -875,7 +875,7 @@ iterable's results. ::
875875
iterators and returns only those elements of *data* for which the corresponding
876876
element of *selectors* is true, stopping whenever either one is exhausted::
877877

878-
itertools.compress([1,2,3,4,5], [True, True, False, False, True]) =>
878+
itertools.compress([1, 2, 3, 4, 5], [True, True, False, False, True]) =>
879879
1, 2, 5
880880

881881

@@ -1035,7 +1035,7 @@ first calculation. ::
10351035
Traceback (most recent call last):
10361036
...
10371037
TypeError: reduce() of empty sequence with no initial value
1038-
>>> functools.reduce(operator.mul, [1,2,3], 1)
1038+
>>> functools.reduce(operator.mul, [1, 2, 3], 1)
10391039
6
10401040
>>> functools.reduce(operator.mul, [], 1)
10411041
1
@@ -1045,9 +1045,9 @@ elements of the iterable. This case is so common that there's a special
10451045
built-in called :func:`sum` to compute it:
10461046

10471047
>>> import functools, operator
1048-
>>> functools.reduce(operator.add, [1,2,3,4], 0)
1048+
>>> functools.reduce(operator.add, [1, 2, 3, 4], 0)
10491049
10
1050-
>>> sum([1,2,3,4])
1050+
>>> sum([1, 2, 3, 4])
10511051
10
10521052
>>> sum([])
10531053
0
@@ -1057,22 +1057,22 @@ write the obvious :keyword:`for` loop::
10571057

10581058
import functools
10591059
# Instead of:
1060-
product = functools.reduce(operator.mul, [1,2,3], 1)
1060+
product = functools.reduce(operator.mul, [1, 2, 3], 1)
10611061

10621062
# You can write:
10631063
product = 1
1064-
for i in [1,2,3]:
1064+
for i in [1, 2, 3]:
10651065
product *= i
10661066

10671067
A related function is :func:`itertools.accumulate(iterable, func=operator.add)
10681068
<itertools.accumulate>`. It performs the same calculation, but instead of
10691069
returning only the final result, :func:`accumulate` returns an iterator that
10701070
also yields each partial result::
10711071

1072-
itertools.accumulate([1,2,3,4,5]) =>
1072+
itertools.accumulate([1, 2, 3, 4, 5]) =>
10731073
1, 3, 6, 10, 15
10741074

1075-
itertools.accumulate([1,2,3,4,5], operator.mul) =>
1075+
itertools.accumulate([1, 2, 3, 4, 5], operator.mul) =>
10761076
1, 2, 6, 24, 120
10771077

10781078

@@ -1156,7 +1156,7 @@ But it would be best of all if I had simply used a ``for`` loop::
11561156

11571157
Or the :func:`sum` built-in and a generator expression::
11581158

1159-
total = sum(b for a,b in items)
1159+
total = sum(b for a, b in items)
11601160

11611161
Many uses of :func:`functools.reduce` are clearer when written as ``for`` loops.
11621162

Doc/howto/logging.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -750,9 +750,9 @@ the new dictionary-based approach:
750750
level: DEBUG
751751
handlers: [console]
752752
propagate: no
753-
root:
754-
level: DEBUG
755-
handlers: [console]
753+
root:
754+
level: DEBUG
755+
handlers: [console]
756756
757757
For more information about logging using a dictionary, see
758758
:ref:`logging-config-api`.

0 commit comments

Comments
 (0)