Skip to content

Commit 34af6e5

Browse files
Merge branch 'master' into capsule-import-submodules
2 parents f386b07 + caccca7 commit 34af6e5

724 files changed

Lines changed: 61440 additions & 39229 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.

.gitattributes

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,20 @@ Lib/test/test_importlib/data01/* -text
3737
*.proj text eol=crlf
3838
PCbuild/readme.txt text eol=crlf
3939
PC/readme.txt text eol=crlf
40+
41+
# Generated files
42+
# https://github.com/github/linguist#generated-code
43+
Include/graminit.h linguist-generated=true
44+
Python/graminit.h linguist-generated=true
45+
Modules/clinic/*.h linguist-generated=true
46+
Objects/clinic/*.h linguist-generated=true
47+
PC/clinic/*.h linguist-generated=true
48+
Python/clinic/*.h linguist-generated=true
49+
Python/importlib.h linguist-generated=true
50+
Python/importlib_external.h linguist-generated=true
51+
Include/Python-ast.h linguist-generated=true
52+
Python/Python-ast.c linguist-generated=true
53+
Include/opcode.h linguist-generated=true
54+
Python/opcode_targets.h linguist-generated=true
55+
Objects/typeslots.inc linguist-generated=true
56+
Modules/unicodedata_db.h linguist-generated=true

.github/CONTRIBUTING.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ Build Status
88

99
+ `Stable buildbots <http://buildbot.python.org/3.x.stable/>`_
1010

11+
- 3.7
12+
13+
+ `Stable buildbots <http://buildbot.python.org/3.7.stable/>`_
14+
1115
- 3.6
1216

1317
+ `Stable buildbots <http://buildbot.python.org/3.6.stable/>`_

.github/appveyor.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,19 @@ before_build:
2020
If (!$changes) {
2121
echo 'Only docs were updated, stopping build process.'
2222
Exit-AppveyorBuild
23+
} else {
24+
echo 'Doing full build due to non-doc changes in these files:'
25+
echo $changes
2326
}
24-
echo 'Doing full build due to non-doc changes in these files:'
25-
echo $changes
2627
}
2728
2829
2930
build_script:
3031
- cmd: PCbuild\build.bat -e
3132
- cmd: PCbuild\win32\python.exe -m test.pythoninfo
3233
test_script:
33-
- cmd: PCbuild\rt.bat -q -uall -u-cpu -rwW --slowest --timeout=1200 --fail-env-changed -j0
34+
- cmd: PCbuild\rt.bat -q -uall -u-cpu -u-largefile -rwW --slowest --timeout=1200 --fail-env-changed -j0
3435
environment:
3536
HOST_PYTHON: C:\Python36\python.exe
3637
image:
37-
- Visual Studio 2017
38+
- Visual Studio 2017

.travis.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ cache:
1212

1313
env:
1414
global:
15-
- OPENSSL=1.1.0g
15+
- OPENSSL=1.1.0h
1616
- OPENSSL_DIR="$HOME/multissl/openssl/${OPENSSL}"
1717
- PATH="${OPENSSL_DIR}/bin:$PATH"
1818
# Use -O3 because we don't use debugger on Travis-CI
@@ -60,15 +60,19 @@ matrix:
6060
env: OPTIONAL=true
6161
before_install:
6262
# Python 3 is needed for Argument Clinic and multissl
63-
- brew install xz python3
63+
- HOMEBREW_NO_AUTO_UPDATE=1 brew install xz python3
6464
- export PATH=$(brew --prefix)/bin:$(brew --prefix)/sbin:$PATH
6565
- os: linux
6666
language: c
6767
compiler: gcc
6868
env: OPTIONAL=true
69+
addons:
70+
apt:
71+
packages:
72+
- lcov
6973
before_script:
7074
- ./configure
71-
- make -s -j4
75+
- make coverage -s -j4
7276
# Need a venv that can parse covered code.
7377
- ./python -m venv venv
7478
- ./venv/bin/python -m pip install -U coverage
@@ -79,6 +83,7 @@ matrix:
7983
after_script: # Probably should be after_success once test suite updated to run under coverage.py.
8084
# Make the `coverage` command available to Codecov w/ a version of Python that can parse all source files.
8185
- source ./venv/bin/activate
86+
- make coverage-lcov
8287
- bash <(curl -s https://codecov.io/bash)
8388

8489

.vsts/linux-buildbot.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ steps:
5454
liblzma-dev
5555
libffi-dev
5656
uuid-dev
57+
xvfb
5758
displayName: 'Install dependencies'
5859
- script: python3 Tools/ssl/multissltests.py --steps=library --base-directory $(build.sourcesDirectory)/multissl --openssl $(OPENSSL) --system Linux
5960
displayName: 'python multissltests.py'
@@ -67,5 +68,5 @@ steps:
6768
- script: make pythoninfo
6869
displayName: 'Display build info'
6970

70-
- script: make buildbottest TESTOPTS="-j4 -uall,-cpu"
71+
- script: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
7172
displayName: 'Tests'

.vsts/linux-coverage.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ steps:
5353
liblzma-dev
5454
libffi-dev
5555
uuid-dev
56+
xvfb
5657
displayName: 'Install dependencies'
5758
- script: python3 Tools/ssl/multissltests.py --steps=library --base-directory $(build.sourcesDirectory)/multissl --openssl $(OPENSSL) --system Linux
5859
displayName: 'python multissltests.py'
@@ -70,7 +71,7 @@ steps:
7071
- script: ./venv/bin/python -m test.pythoninfo
7172
displayName: 'Display build info'
7273

73-
- script: ./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
74+
- 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
7475
displayName: 'Tests with coverage'
7576

7677
- script: source ./venv/bin/activate && bash <(curl -s https://codecov.io/bash)

.vsts/linux-deps.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ steps:
3131
liblzma-dev
3232
libffi-dev
3333
uuid-dev
34+
xvfb
3435
displayName: 'Install dependencies'
3536
- script: python3 Tools/ssl/multissltests.py --steps=library --base-directory $(build.sourcesDirectory)/multissl --openssl $(OPENSSL) --system Linux
3637
displayName: 'python multissltests.py'

.vsts/linux-pr.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ steps:
5353
liblzma-dev
5454
libffi-dev
5555
uuid-dev
56+
xvfb
5657
displayName: 'Install dependencies'
5758
- script: python3 Tools/ssl/multissltests.py --steps=library --base-directory $(build.sourcesDirectory)/multissl --openssl $(OPENSSL) --system Linux
5859
displayName: 'python multissltests.py'
@@ -71,5 +72,5 @@ steps:
7172
- script: ./python Tools/scripts/patchcheck.py --travis true
7273
displayName: 'Run patchcheck.py'
7374

74-
- script: make buildbottest TESTOPTS="-j4 -uall,-cpu"
75+
- script: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
7576
displayName: 'Tests'

Doc/c-api/concrete.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,5 @@ Other Objects
113113
capsule.rst
114114
gen.rst
115115
coro.rst
116+
contextvars.rst
116117
datetime.rst
117-

Doc/c-api/contextvars.rst

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
.. highlightlang:: c
2+
3+
.. _contextvarsobjects:
4+
5+
Context Variables Objects
6+
-------------------------
7+
8+
.. versionadded:: 3.7
9+
10+
This section details the public C API for the :mod:`contextvars` module.
11+
12+
.. c:type:: PyContext
13+
14+
The C structure used to represent a :class:`contextvars.Context`
15+
object.
16+
17+
.. c:type:: PyContextVar
18+
19+
The C structure used to represent a :class:`contextvars.ContextVar`
20+
object.
21+
22+
.. c:type:: PyContextToken
23+
24+
The C structure used to represent a :class:`contextvars.Token` object.
25+
26+
.. c:var:: PyTypeObject PyContext_Type
27+
28+
The type object representing the *context* type.
29+
30+
.. c:var:: PyTypeObject PyContextVar_Type
31+
32+
The type object representing the *context variable* type.
33+
34+
.. c:var:: PyTypeObject PyContextToken_Type
35+
36+
The type object representing the *context variable token* type.
37+
38+
39+
Type-check macros:
40+
41+
.. c:function:: int PyContext_CheckExact(PyObject *o)
42+
43+
Return true if *o* is of type :c:data:`PyContext_Type`. *o* must not be
44+
*NULL*. This function always succeeds.
45+
46+
.. c:function:: int PyContextVar_CheckExact(PyObject *o)
47+
48+
Return true if *o* is of type :c:data:`PyContextVar_Type`. *o* must not be
49+
*NULL*. This function always succeeds.
50+
51+
.. c:function:: int PyContextToken_CheckExact(PyObject *o)
52+
53+
Return true if *o* is of type :c:data:`PyContextToken_Type`.
54+
*o* must not be *NULL*. This function always succeeds.
55+
56+
57+
Context object management functions:
58+
59+
.. c:function:: PyContext *PyContext_New(void)
60+
61+
Create a new empty context object. Returns ``NULL`` if an error
62+
has occurred.
63+
64+
.. c:function:: PyContext *PyContext_Copy(PyContext *ctx)
65+
66+
Create a shallow copy of the passed *ctx* context object.
67+
Returns ``NULL`` if an error has occurred.
68+
69+
.. c:function:: PyContext *PyContext_CopyCurrent(void)
70+
71+
Create a shallow copy of the current thread context.
72+
Returns ``NULL`` if an error has occurred.
73+
74+
.. c:function:: int PyContext_Enter(PyContext *ctx)
75+
76+
Set *ctx* as the current context for the current thread.
77+
Returns ``0`` on success, and ``-1`` on error.
78+
79+
.. c:function:: int PyContext_Exit(PyContext *ctx)
80+
81+
Deactivate the *ctx* context and restore the previous context as the
82+
current context for the current thread. Returns ``0`` on success,
83+
and ``-1`` on error.
84+
85+
.. c:function:: int PyContext_ClearFreeList()
86+
87+
Clear the context variable free list. Return the total number of
88+
freed items. This function always succeeds.
89+
90+
91+
Context variable functions:
92+
93+
.. c:function:: PyContextVar *PyContextVar_New(const char *name, PyObject *def)
94+
95+
Create a new ``ContextVar`` object. The *name* parameter is used
96+
for introspection and debug purposes. The *def* parameter may optionally
97+
specify the default value for the context variable. If an error has
98+
occurred, this function returns ``NULL``.
99+
100+
.. c:function:: int PyContextVar_Get(PyContextVar *var, PyObject *default_value, PyObject **value)
101+
102+
Get the value of a context variable. Returns ``-1`` if an error has
103+
occurred during lookup, and ``0`` if no error occurred, whether or not
104+
a value was found.
105+
106+
If the context variable was found, *value* will be a pointer to it.
107+
If the context variable was *not* found, *value* will point to:
108+
109+
- *default_value*, if not ``NULL``;
110+
- the default value of *var*, if not ``NULL``;
111+
- ``NULL``
112+
113+
If the value was found, the function will create a new reference to it.
114+
115+
.. c:function:: PyContextToken *PyContextVar_Set(PyContextVar *var, PyObject *value)
116+
117+
Set the value of *var* to *value* in the current context. Returns a
118+
pointer to a :c:type:`PyContextToken` object, or ``NULL`` if an error
119+
has occurred.
120+
121+
.. c:function:: int PyContextVar_Reset(PyContextVar *var, PyContextToken *token)
122+
123+
Reset the state of the *var* context variable to that it was in before
124+
:c:func:`PyContextVar_Set` that returned the *token* was called.
125+
This function returns ``0`` on success and ``-1`` on error.

0 commit comments

Comments
 (0)