Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit 863b822

Browse files
author
Anselm Kruis
committed
Merge branch 3.7 into 3.7-slp
2 parents 50ca3dc + 2469066 commit 863b822

File tree

100 files changed

+736
-178
lines changed

Some content is hidden

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

100 files changed

+736
-178
lines changed

.github/workflows/build.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Tests
2+
3+
on:
4+
#push:
5+
# branches:
6+
# - master
7+
# - 3.8
8+
# - 3.7
9+
# paths-ignore:
10+
# - 'Doc/**'
11+
# - 'Misc/**'
12+
pull_request:
13+
branches:
14+
- master
15+
- 3.8
16+
- 3.7
17+
paths-ignore:
18+
- 'Doc/**'
19+
- 'Misc/**'
20+
21+
jobs:
22+
build_win32:
23+
name: 'Windows (x86)'
24+
runs-on: windows-latest
25+
steps:
26+
- uses: actions/checkout@v1
27+
- name: Build CPython
28+
run: .\PCbuild\build.bat -e -p Win32
29+
- name: Display build info
30+
run: .\python.bat -m test.pythoninfo
31+
- name: Tests
32+
run: .\PCbuild\rt.bat -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
33+
34+
build_win_amd64:
35+
name: 'Windows (x64)'
36+
runs-on: windows-latest
37+
steps:
38+
- uses: actions/checkout@v1
39+
- name: Build CPython
40+
run: .\PCbuild\build.bat -e -p x64
41+
- name: Display build info
42+
run: .\python.bat -m test.pythoninfo
43+
- name: Tests
44+
run: .\PCbuild\rt.bat -x64 -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
45+
46+
build_macos:
47+
name: 'macOS'
48+
runs-on: macos-latest
49+
steps:
50+
- uses: actions/checkout@v1
51+
- name: Configure CPython
52+
run: ./configure --with-pydebug --with-openssl=/usr/local/opt/openssl --prefix=/opt/python-dev
53+
- name: Build CPython
54+
run: make -s -j4
55+
- name: Display build info
56+
run: make pythoninfo
57+
- name: Tests
58+
run: make buildbottest TESTOPTS="-j4 -uall,-cpu"
59+
60+
build_ubuntu:
61+
name: 'Ubuntu'
62+
runs-on: ubuntu-latest
63+
env:
64+
OPENSSL_VER: 1.1.1d
65+
steps:
66+
- uses: actions/checkout@v1
67+
- name: Install Dependencies
68+
run: sudo ./.github/workflows/posix-deps-apt.sh
69+
- name: 'Restore OpenSSL build'
70+
id: cache-openssl
71+
uses: actions/cache@v1
72+
with:
73+
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
74+
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
75+
- name: Install OpenSSL
76+
if: steps.cache-openssl.outputs.cache-hit != 'true'
77+
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $PWD/multissl --openssl $OPENSSL_VER --system Linux
78+
- name: Configure CPython
79+
run: ./configure --with-pydebug --with-openssl=$PWD/multissl/openssl/$OPENSSL_VER
80+
- name: Build CPython
81+
run: make -s -j4
82+
- name: Display build info
83+
run: make pythoninfo
84+
- name: Tests
85+
run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"

.github/workflows/coverage.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Coverage
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- 3.8
8+
- 3.7
9+
paths-ignore:
10+
- 'Doc/**'
11+
- 'Misc/**'
12+
#pull_request:
13+
# branches:
14+
# - master
15+
# - 3.8
16+
# - 3.7
17+
# paths-ignore:
18+
# - 'Doc/**'
19+
# - 'Misc/**'
20+
21+
jobs:
22+
coverage_ubuntu:
23+
name: 'Ubuntu (Coverage)'
24+
runs-on: ubuntu-latest
25+
env:
26+
OPENSSL_VER: 1.1.1d
27+
steps:
28+
- uses: actions/checkout@v1
29+
- name: Install Dependencies
30+
run: sudo ./.github/workflows/posix-deps-apt.sh
31+
- name: 'Restore OpenSSL build'
32+
id: cache-openssl
33+
uses: actions/cache@v1
34+
with:
35+
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
36+
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
37+
- name: Install OpenSSL
38+
if: steps.cache-openssl.outputs.cache-hit != 'true'
39+
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $PWD/multissl --openssl $OPENSSL_VER --system Linux
40+
- name: Configure CPython
41+
run: ./configure --with-openssl=$PWD/multissl/openssl/$OPENSSL_VER
42+
- name: Build CPython
43+
run: make -s -j4
44+
- name: Display build info
45+
run: make pythoninfo
46+
- name: 'Coverage Preparation'
47+
run: |
48+
./python -m venv .venv
49+
source ./.venv/bin/activate
50+
python -m pip install -U coverage
51+
python -m test.pythoninfo
52+
- name: 'Tests with coverage'
53+
run: >
54+
source ./.venv/bin/activate &&
55+
xvfb-run python -m coverage
56+
run --branch --pylib
57+
-m test
58+
--fail-env-changed
59+
-uall,-cpu
60+
-x test_multiprocessing_fork
61+
-x test_multiprocessing_forkserver
62+
-x test_multiprocessing_spawn
63+
-x test_concurrent_futures
64+
|| true
65+
- name: 'Publish code coverage results'
66+
run: |
67+
source ./.venv/bin/activate
68+
bash <(curl -s https://codecov.io/bash)
69+
env:
70+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
71+
72+
c_coverage_ubuntu:
73+
name: 'Ubuntu (C Coverage)'
74+
runs-on: ubuntu-latest
75+
steps:
76+
- uses: actions/checkout@v1
77+
- name: Install Dependencies
78+
run: sudo ./.github/workflows/posix-deps-apt.sh
79+
- name: Configure CPython
80+
run: ./configure
81+
- name: 'Build CPython and measure coverage'
82+
run: xvfb-run make -j4 coverage-report
83+
- name: 'Publish code coverage results'
84+
if: always()
85+
run: |
86+
make pythoninfo
87+
bash <(curl -s https://codecov.io/bash)
88+
env:
89+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/doc.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Docs
2+
3+
on:
4+
#push:
5+
# branches:
6+
# - master
7+
# - 3.8
8+
# - 3.7
9+
# paths:
10+
# - 'Doc/**'
11+
pull_request:
12+
branches:
13+
- master
14+
- 3.8
15+
- 3.7
16+
paths:
17+
- 'Doc/**'
18+
- 'Misc/**'
19+
20+
jobs:
21+
build_doc:
22+
name: 'Docs'
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v1
26+
- uses: actions/setup-python@v1
27+
with:
28+
python-version: '3.7'
29+
architecture: 'x64'
30+
- name: 'Install build dependencies'
31+
run: python -m pip install sphinx==2.2.0 blurb python-docs-theme
32+
- name: 'Build documentation'
33+
run: |
34+
cd Doc
35+
make check suspicious html PYTHON=python
36+
- name: Upload
37+
uses: actions/upload-artifact@v1
38+
with:
39+
name: doc-html
40+
path: Doc/build/html

.github/workflows/posix-deps-apt.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
apt-get update
3+
4+
apt-get -yq install \
5+
build-essential \
6+
zlib1g-dev \
7+
libbz2-dev \
8+
liblzma-dev \
9+
libncurses5-dev \
10+
libreadline6-dev \
11+
libsqlite3-dev \
12+
libssl-dev \
13+
libgdbm-dev \
14+
tk-dev \
15+
lzma \
16+
lzma-dev \
17+
liblzma-dev \
18+
libffi-dev \
19+
uuid-dev \
20+
xvfb \
21+
lcov

Doc/c-api/iter.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ something like this::
2929
/* propagate error */
3030
}
3131
32-
while (item = PyIter_Next(iterator)) {
32+
while ((item = PyIter_Next(iterator))) {
3333
/* do something with item */
3434
...
3535
/* release reference when done */

Doc/copyright.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Copyright
44

55
Python and this documentation is:
66

7-
Copyright © 2001-2019 Python Software Foundation. All rights reserved.
7+
Copyright © 2001-2020 Python Software Foundation. All rights reserved.
88

99
Copyright © 2000 BeOpen.com. All rights reserved.
1010

Doc/faq/programming.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,7 @@ That's a tough one, in general. First, here are a list of things to
10261026
remember before diving further:
10271027

10281028
* Performance characteristics vary across Python implementations. This FAQ
1029-
focusses on :term:`CPython`.
1029+
focuses on :term:`CPython`.
10301030
* Behaviour can vary across operating systems, especially when talking about
10311031
I/O or multi-threading.
10321032
* You should always find the hot spots in your program *before* attempting to

Doc/howto/pyporting.rst

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ Once you have your code well-tested you are ready to begin porting your code to
119119
Python 3! But to fully understand how your code is going to change and what
120120
you want to look out for while you code, you will want to learn what changes
121121
Python 3 makes in terms of Python 2. Typically the two best ways of doing that
122-
is reading the `"What's New"`_ doc for each release of Python 3 and the
122+
is reading the :ref:`"What's New" <whatsnew-index>` doc for each release of Python 3 and the
123123
`Porting to Python 3`_ book (which is free online). There is also a handy
124124
`cheat sheet`_ from the Python-Future project.
125125

@@ -302,10 +302,10 @@ If for some reason that doesn't work then you should make the version check be
302302
against Python 2 and not Python 3. To help explain this, let's look at an
303303
example.
304304

305-
Let's pretend that you need access to a feature of importlib_ that
305+
Let's pretend that you need access to a feature of :mod:`importlib` that
306306
is available in Python's standard library since Python 3.3 and available for
307307
Python 2 through importlib2_ on PyPI. You might be tempted to write code to
308-
access e.g. the ``importlib.abc`` module by doing the following::
308+
access e.g. the :mod:`importlib.abc` module by doing the following::
309309

310310
import sys
311311

@@ -426,12 +426,10 @@ can also explicitly state whether your APIs use textual or binary data, helping
426426
to make sure everything functions as expected in both versions of Python.
427427

428428

429-
.. _2to3: https://docs.python.org/3/library/2to3.html
430429
.. _caniusepython3: https://pypi.org/project/caniusepython3
431430
.. _cheat sheet: http://python-future.org/compatible_idioms.html
432431
.. _coverage.py: https://pypi.org/project/coverage
433432
.. _Futurize: http://python-future.org/automatic_conversion.html
434-
.. _importlib: https://docs.python.org/3/library/importlib.html#module-importlib
435433
.. _importlib2: https://pypi.org/project/importlib2
436434
.. _Modernize: https://python-modernize.readthedocs.io/
437435
.. _mypy: http://mypy-lang.org/
@@ -447,6 +445,4 @@ to make sure everything functions as expected in both versions of Python.
447445
.. _tox: https://pypi.org/project/tox
448446
.. _trove classifier: https://pypi.org/classifiers
449447

450-
.. _"What's New": https://docs.python.org/3/whatsnew/index.html
451-
452448
.. _Why Python 3 exists: https://snarky.ca/why-python-3-exists

Doc/includes/custom.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ PyInit_custom(void)
3737
Py_INCREF(&CustomType);
3838
if (PyModule_AddObject(m, "Custom", (PyObject *) &CustomType) < 0) {
3939
Py_DECREF(&CustomType);
40-
PY_DECREF(m);
40+
Py_DECREF(m);
4141
return NULL;
4242
}
4343

Doc/library/ast.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ and classes for traversing abstract syntax trees:
240240
class RewriteName(NodeTransformer):
241241

242242
def visit_Name(self, node):
243-
return copy_location(Subscript(
243+
return Subscript(
244244
value=Name(id='data', ctx=Load()),
245245
slice=Index(value=Str(s=node.id)),
246246
ctx=node.ctx
@@ -254,6 +254,14 @@ and classes for traversing abstract syntax trees:
254254
statement nodes), the visitor may also return a list of nodes rather than
255255
just a single node.
256256

257+
If :class:`NodeTransformer` introduces new nodes (that weren't part of
258+
original tree) without giving them location information (such as
259+
:attr:`lineno`), :func:`fix_missing_locations` should be called with
260+
the new sub-tree to recalculate the location information::
261+
262+
tree = ast.parse('foo', mode='eval')
263+
new_tree = fix_missing_locations(RewriteName().visit(tree))
264+
257265
Usually you use the transformer like this::
258266

259267
node = YourTransformer().visit(node)

0 commit comments

Comments
 (0)