Skip to content

Commit 07a979f

Browse files
committed
Merge remote-tracking branch 'upstream/master' into bpo-30555-windowsconsoleio-fd-redirection
2 parents 9dd4ea9 + 67ba4fa commit 07a979f

File tree

393 files changed

+48542
-43818
lines changed

Some content is hidden

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

393 files changed

+48542
-43818
lines changed

.gitattributes

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,41 @@
1+
# Binary data types
2+
*.aif binary
3+
*.aifc binary
4+
*.aiff binary
5+
*.au binary
6+
*.bmp binary
7+
*.exe binary
8+
*.icns binary
9+
*.gif binary
10+
*.ico binary
11+
*.jpg binary
112
*.pck binary
2-
Lib/test/cjkencodings/* binary
3-
Lib/test/decimaltestdata/*.decTest binary
13+
*.png binary
14+
*.psd binary
15+
*.tar binary
16+
*.wav binary
17+
*.whl binary
18+
*.zip binary
19+
20+
# Specific binary files
421
Lib/test/sndhdrdata/sndhdr.* binary
5-
Lib/test/test_email/data/msg_26.txt binary
6-
Lib/test/xmltestdata/* binary
7-
Lib/venv/scripts/nt/* binary
8-
Lib/test/coding20731.py binary
22+
23+
# Text files that should not be subject to eol conversion
24+
Lib/test/cjkencodings/* -text
25+
Lib/test/decimaltestdata/*.decTest -text
26+
Lib/test/test_email/data/*.txt -text
27+
Lib/test/xmltestdata/* -text
28+
Lib/test/coding20731.py -text
29+
30+
# Special files in third party code
31+
Modules/zlib/zlib.map -text
32+
33+
# CRLF files
34+
*.bat text eol=crlf
35+
*.ps1 text eol=crlf
36+
*.sln text eol=crlf
37+
*.vcxproj* text eol=crlf
38+
*.props text eol=crlf
39+
*.proj text eol=crlf
40+
PCbuild/readme.txt text eol=crlf
41+
PC/readme.txt text eol=crlf

.github/appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ branches:
88
build_script:
99
- cmd: PCbuild\build.bat -e
1010
test_script:
11-
- cmd: PCbuild\rt.bat -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
11+
- cmd: PCbuild\rt.bat -q -uall -u-cpu -rwW --slowest --timeout=1200 --fail-env-changed -j0
1212

1313
# Only trigger AppVeyor if actual code or its configuration changes
1414
only_commits:

.travis.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,29 @@ matrix:
7171
# Travis provides only 2 cores, so don't overdo the parallelism and waste memory.
7272
before_script:
7373
- |
74+
set -e
7475
if ! git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.rst$)|(^Doc)|(^Misc)'
7576
then
7677
echo "Only docs were updated, stopping build process."
7778
exit
7879
fi
7980
./configure --with-pydebug
8081
make -j4
82+
make -j4 regen-all clinic
83+
changes=`git status --porcelain`
84+
if ! test -z "$changes"
85+
then
86+
echo "Generated files not up to date"
87+
echo "$changes"
88+
exit 1
89+
fi
8190
8291
script:
92+
# Using the built Python as patchcheck.py is built around the idea of using
93+
# a checkout-build of CPython to know things like what base branch the changes
94+
# should be compared against.
95+
# Only run on Linux as the check only needs to be run once.
96+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./python Tools/scripts/patchcheck.py --travis $TRAVIS_PULL_REQUEST; fi
8397
# `-r -w` implicitly provided through `make buildbottest`.
8498
- make buildbottest TESTOPTS="-j4 -uall,-cpu,-tzdata"
8599

Doc/c-api/memory.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,28 @@ Customize pymalloc Arena Allocator
429429
Set the arena allocator.
430430
431431
432+
tracemalloc C API
433+
=================
434+
435+
.. versionadded:: 3.7
436+
437+
.. c:function: int PyTraceMalloc_Track(unsigned int domain, uintptr_t ptr, size_t size)
438+
439+
Track an allocated memory block in the :mod:`tracemalloc` module.
440+
441+
Return 0 on success, return ``-1`` on error (failed to allocate memory to
442+
store the trace). Return ``-2`` if tracemalloc is disabled.
443+
444+
If memory block is already tracked, update the existing trace.
445+
446+
.. c:function: int PyTraceMalloc_Untrack(unsigned int domain, uintptr_t ptr)
447+
448+
Untrack an allocated memory block in the :mod:`tracemalloc` module.
449+
Do nothing if the block was not tracked.
450+
451+
Return ``-2`` if tracemalloc is disabled, otherwise return ``0``.
452+
453+
432454
.. _memoryexamples:
433455
434456
Examples

Doc/c-api/module.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Module Objects
5050
5151
.. c:function:: PyObject* PyModule_New(const char *name)
5252
53-
Similar to :c:func:`PyImport_NewObject`, but the name is a UTF-8 encoded
53+
Similar to :c:func:`PyModule_NewObject`, but the name is a UTF-8 encoded
5454
string instead of a Unicode object.
5555
5656

Doc/c-api/unicode.rst

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -934,16 +934,22 @@ wchar_t Support
934934
Convert the Unicode object to a wide character string. The output string
935935
always ends with a null character. If *size* is not *NULL*, write the number
936936
of wide characters (excluding the trailing null termination character) into
937-
*\*size*.
937+
*\*size*. Note that the resulting :c:type:`wchar_t` string might contain
938+
null characters, which would cause the string to be truncated when used with
939+
most C functions. If *size* is *NULL* and the :c:type:`wchar_t*` string
940+
contains null characters a :exc:`ValueError` is raised.
938941
939942
Returns a buffer allocated by :c:func:`PyMem_Alloc` (use
940-
:c:func:`PyMem_Free` to free it) on success. On error, returns *NULL*,
941-
*\*size* is undefined and raises a :exc:`MemoryError`. Note that the
942-
resulting :c:type:`wchar_t` string might contain null characters, which
943-
would cause the string to be truncated when used with most C functions.
943+
:c:func:`PyMem_Free` to free it) on success. On error, returns *NULL*
944+
and *\*size* is undefined. Raises a :exc:`MemoryError` if memory allocation
945+
is failed.
944946
945947
.. versionadded:: 3.2
946948
949+
.. versionchanged:: 3.7
950+
Raises a :exc:`ValueError` if *size* is *NULL* and the :c:type:`wchar_t*`
951+
string contains null characters.
952+
947953
948954
.. _builtincodecs:
949955

Doc/faq/gui.rst

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,6 @@ Python bindings for `the FLTK toolkit <http://www.fltk.org>`_, a simple yet
9494
powerful and mature cross-platform windowing system, are available from `the
9595
PyFLTK project <http://pyfltk.sourceforge.net>`_.
9696

97-
98-
FOX
99-
----
100-
101-
A wrapper for `the FOX toolkit <http://www.fox-toolkit.org/>`_ called `FXpy
102-
<http://fxpy.sourceforge.net/>`_ is available. FOX supports both Unix variants
103-
and Windows.
104-
105-
10697
OpenGL
10798
------
10899

Doc/howto/descriptor.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,10 @@ to wrap access to the value attribute in a property data descriptor::
252252

253253
class Cell(object):
254254
. . .
255-
def getvalue(self, obj):
256-
"Recalculate cell before returning value"
255+
def getvalue(self):
256+
"Recalculate the cell before returning value"
257257
self.recalc()
258-
return obj._value
258+
return self._value
259259
value = property(getvalue)
260260

261261

Doc/library/asyncio-protocol.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,17 @@ WriteTransport
163163

164164
Set the *high*- and *low*-water limits for write flow control.
165165

166-
These two values control when call the protocol's
166+
These two values (measured in number of
167+
bytes) control when the protocol's
167168
:meth:`pause_writing` and :meth:`resume_writing` methods are called.
168169
If specified, the low-water limit must be less than or equal to the
169170
high-water limit. Neither *high* nor *low* can be negative.
170171

172+
:meth:`pause_writing` is called when the buffer size becomes greater
173+
than or equal to the *high* value. If writing has been paused,
174+
:meth:`resume_writing` is called when the buffer size becomes less
175+
than or equal to the *low* value.
176+
171177
The defaults are implementation-specific. If only the
172178
high-water limit is given, the low-water limit defaults to an
173179
implementation-specific value less than or equal to the

Doc/library/collections.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ field names, the method and attribute names start with an underscore.
866866
.. versionchanged:: 3.1
867867
Returns an :class:`OrderedDict` instead of a regular :class:`dict`.
868868

869-
.. method:: somenamedtuple._replace(kwargs)
869+
.. method:: somenamedtuple._replace(**kwargs)
870870

871871
Return a new instance of the named tuple replacing specified fields with new
872872
values::

Doc/library/curses.rst

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,34 +1271,70 @@ The :mod:`curses` module defines the following data members:
12711271
A string representing the current version of the module. Also available as
12721272
:const:`__version__`.
12731273

1274-
Several constants are available to specify character cell attributes:
1274+
Some constants are available to specify character cell attributes.
1275+
The exact constants available are system dependent.
12751276

12761277
+------------------+-------------------------------+
12771278
| Attribute | Meaning |
12781279
+==================+===============================+
1279-
| ``A_ALTCHARSET`` | Alternate character set mode. |
1280+
| ``A_ALTCHARSET`` | Alternate character set mode |
12801281
+------------------+-------------------------------+
1281-
| ``A_BLINK`` | Blink mode. |
1282+
| ``A_BLINK`` | Blink mode |
12821283
+------------------+-------------------------------+
1283-
| ``A_BOLD`` | Bold mode. |
1284+
| ``A_BOLD`` | Bold mode |
12841285
+------------------+-------------------------------+
1285-
| ``A_ITALIC`` | Italic mode. |
1286+
| ``A_DIM`` | Dim mode |
12861287
+------------------+-------------------------------+
1287-
| ``A_DIM`` | Dim mode. |
1288+
| ``A_INVIS`` | Invisible or blank mode |
12881289
+------------------+-------------------------------+
1289-
| ``A_NORMAL`` | Normal attribute. |
1290+
| ``A_ITALIC`` | Italic mode |
1291+
+------------------+-------------------------------+
1292+
| ``A_NORMAL`` | Normal attribute |
1293+
+------------------+-------------------------------+
1294+
| ``A_PROTECT`` | Protected mode |
12901295
+------------------+-------------------------------+
12911296
| ``A_REVERSE`` | Reverse background and |
1292-
| | foreground colors. |
1297+
| | foreground colors |
1298+
+------------------+-------------------------------+
1299+
| ``A_STANDOUT`` | Standout mode |
1300+
+------------------+-------------------------------+
1301+
| ``A_UNDERLINE`` | Underline mode |
1302+
+------------------+-------------------------------+
1303+
| ``A_HORIZONTAL`` | Horizontal highlight |
1304+
+------------------+-------------------------------+
1305+
| ``A_LEFT`` | Left highlight |
1306+
+------------------+-------------------------------+
1307+
| ``A_LOW`` | Low highlight |
1308+
+------------------+-------------------------------+
1309+
| ``A_RIGHT`` | Right highlight |
12931310
+------------------+-------------------------------+
1294-
| ``A_STANDOUT`` | Standout mode. |
1311+
| ``A_TOP`` | Top highlight |
12951312
+------------------+-------------------------------+
1296-
| ``A_UNDERLINE`` | Underline mode. |
1313+
| ``A_VERTICAL`` | Vertical highlight |
1314+
+------------------+-------------------------------+
1315+
| ``A_CHARTEXT`` | Bit-mask to extract a |
1316+
| | character |
12971317
+------------------+-------------------------------+
12981318

12991319
.. versionadded:: 3.7
13001320
``A_ITALIC`` was added.
13011321

1322+
Several constants are available to extract corresponding attributes returned
1323+
by some methods.
1324+
1325+
+------------------+-------------------------------+
1326+
| Bit-mask | Meaning |
1327+
+==================+===============================+
1328+
| ``A_ATTRIBUTES`` | Bit-mask to extract |
1329+
| | attributes |
1330+
+------------------+-------------------------------+
1331+
| ``A_CHARTEXT`` | Bit-mask to extract a |
1332+
| | character |
1333+
+------------------+-------------------------------+
1334+
| ``A_COLOR`` | Bit-mask to extract |
1335+
| | color-pair field information |
1336+
+------------------+-------------------------------+
1337+
13021338
Keys are referred to by integer constants with names starting with ``KEY_``.
13031339
The exact keycaps available are system dependent.
13041340

Doc/library/dis.rst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,23 +138,32 @@ operation is being performed, so the intermediate analysis object isn't useful:
138138
Added *file* parameter.
139139

140140

141-
.. function:: dis(x=None, *, file=None)
141+
.. function:: dis(x=None, *, file=None, depth=None)
142142

143143
Disassemble the *x* object. *x* can denote either a module, a class, a
144144
method, a function, a generator, a code object, a string of source code or
145145
a byte sequence of raw bytecode. For a module, it disassembles all functions.
146146
For a class, it disassembles all methods (including class and static methods).
147147
For a code object or sequence of raw bytecode, it prints one line per bytecode
148-
instruction. Strings are first compiled to code objects with the :func:`compile`
148+
instruction. It also recursively disassembles nested code objects (the code
149+
of comprehensions, generator expressions and nested functions, and the code
150+
used for building nested classes).
151+
Strings are first compiled to code objects with the :func:`compile`
149152
built-in function before being disassembled. If no object is provided, this
150153
function disassembles the last traceback.
151154

152155
The disassembly is written as text to the supplied *file* argument if
153156
provided and to ``sys.stdout`` otherwise.
154157

158+
The maximal depth of recursion is limited by *depth* unless it is ``None``.
159+
``depth=0`` means no recursion.
160+
155161
.. versionchanged:: 3.4
156162
Added *file* parameter.
157163

164+
.. versionchanged:: 3.7
165+
Implemented recursive disassembling and added *depth* parameter.
166+
158167

159168
.. function:: distb(tb=None, *, file=None)
160169

0 commit comments

Comments
 (0)