Skip to content

Commit ad77cd3

Browse files
committed
Merge remote-tracking branch 'upstream/master' into bpo-30555-windowsconsoleio-fd-redirection
2 parents 82a18bb + 171b9a3 commit ad77cd3

83 files changed

Lines changed: 1784 additions & 1198 deletions

Some content is hidden

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

.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 -rwW --slowest --timeout=1200 -j0
11+
- cmd: PCbuild\rt.bat -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
1212

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

.github/codecov.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
codecov:
2+
strict_yaml_branch: master
23
notify:
34
require_ci_to_pass: true
45
comment: off

Doc/library/asyncio-task.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,11 @@ Task functions
540540

541541
.. deprecated:: 3.4.4
542542

543+
.. function:: wrap_future(future, \*, loop=None)
544+
545+
Wrap a :class:`concurrent.futures.Future` object in a :class:`Future`
546+
object.
547+
543548
.. function:: gather(\*coros_or_futures, loop=None, return_exceptions=False)
544549

545550
Return a future aggregating results from the given coroutine objects or

Doc/library/fnmatch.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ patterns.
4343
.. function:: fnmatch(filename, pattern)
4444

4545
Test whether the *filename* string matches the *pattern* string, returning
46-
:const:`True` or :const:`False`. If the operating system is case-insensitive,
47-
then both parameters will be normalized to all lower- or upper-case before
48-
the comparison is performed. :func:`fnmatchcase` can be used to perform a
46+
:const:`True` or :const:`False`. Both parameters are case-normalized
47+
using :func:`os.path.normcase`. :func:`fnmatchcase` can be used to perform a
4948
case-sensitive comparison, regardless of whether that's standard for the
5049
operating system.
5150

@@ -63,7 +62,8 @@ patterns.
6362
.. function:: fnmatchcase(filename, pattern)
6463

6564
Test whether *filename* matches *pattern*, returning :const:`True` or
66-
:const:`False`; the comparison is case-sensitive.
65+
:const:`False`; the comparison is case-sensitive and does not apply
66+
:func:`os.path.normcase`.
6767

6868

6969
.. function:: filter(names, pattern)

Doc/library/ssl.rst

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,9 @@ Certificate handling
378378
Verify that *cert* (in decoded format as returned by
379379
:meth:`SSLSocket.getpeercert`) matches the given *hostname*. The rules
380380
applied are those for checking the identity of HTTPS servers as outlined
381-
in :rfc:`2818` and :rfc:`6125`. In addition to HTTPS, this function
382-
should be suitable for checking the identity of servers in various
383-
SSL-based protocols such as FTPS, IMAPS, POPS and others.
381+
in :rfc:`2818`, :rfc:`5280` and :rfc:`6125`. In addition to HTTPS, this
382+
function should be suitable for checking the identity of servers in
383+
various SSL-based protocols such as FTPS, IMAPS, POPS and others.
384384

385385
:exc:`CertificateError` is raised on failure. On success, the function
386386
returns nothing::
@@ -824,7 +824,7 @@ Constants
824824
.. data:: HAS_SNI
825825

826826
Whether the OpenSSL library has built-in support for the *Server Name
827-
Indication* extension (as defined in :rfc:`4366`).
827+
Indication* extension (as defined in :rfc:`6066`).
828828

829829
.. versionadded:: 3.2
830830

@@ -2313,14 +2313,11 @@ successful call of :func:`~ssl.RAND_add`, :func:`~ssl.RAND_bytes` or
23132313
`RFC 1422: Privacy Enhancement for Internet Electronic Mail: Part II: Certificate-Based Key Management <https://www.ietf.org/rfc/rfc1422>`_
23142314
Steve Kent
23152315

2316-
`RFC 1750: Randomness Recommendations for Security <https://www.ietf.org/rfc/rfc1750>`_
2317-
D. Eastlake et. al.
2316+
`RFC 4086: Randomness Requirements for Security <http://datatracker.ietf.org/doc/rfc4086/>`_
2317+
Donald E., Jeffrey I. Schiller
23182318

2319-
`RFC 3280: Internet X.509 Public Key Infrastructure Certificate and CRL Profile <https://www.ietf.org/rfc/rfc3280>`_
2320-
Housley et. al.
2321-
2322-
`RFC 4366: Transport Layer Security (TLS) Extensions <https://www.ietf.org/rfc/rfc4366>`_
2323-
Blake-Wilson et. al.
2319+
`RFC 5280: Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile <http://datatracker.ietf.org/doc/rfc5280/>`_
2320+
D. Cooper
23242321

23252322
`RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2 <https://tools.ietf.org/html/rfc5246>`_
23262323
T. Dierks et. al.

Doc/library/stdtypes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,10 +394,12 @@ Bitwise Operations on Integer Types
394394
pair: bitwise; operations
395395
pair: shifting; operations
396396
pair: masking; operations
397+
operator: |
397398
operator: ^
398399
operator: &
399400
operator: <<
400401
operator: >>
402+
operator: ~
401403

402404
Bitwise operations only make sense for integers. Negative numbers are treated
403405
as their 2's complement value (this assumes that there are enough bits so that

Doc/library/unittest.rst

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,6 +1170,9 @@ Test cases
11701170
:meth:`.assertRegex`.
11711171
.. versionadded:: 3.2
11721172
:meth:`.assertNotRegex`.
1173+
.. versionadded:: 3.5
1174+
The name ``assertNotRegexpMatches`` is a deprecated alias
1175+
for :meth:`.assertNotRegex`.
11731176

11741177

11751178
.. method:: assertCountEqual(first, second, msg=None)
@@ -1435,9 +1438,9 @@ For historical reasons, some of the :class:`TestCase` methods had one or more
14351438
aliases that are now deprecated. The following table lists the correct names
14361439
along with their deprecated aliases:
14371440

1438-
============================== ====================== ======================
1441+
============================== ====================== =======================
14391442
Method Name Deprecated alias Deprecated alias
1440-
============================== ====================== ======================
1443+
============================== ====================== =======================
14411444
:meth:`.assertEqual` failUnlessEqual assertEquals
14421445
:meth:`.assertNotEqual` failIfEqual assertNotEquals
14431446
:meth:`.assertTrue` failUnless assert\_
@@ -1446,17 +1449,19 @@ along with their deprecated aliases:
14461449
:meth:`.assertAlmostEqual` failUnlessAlmostEqual assertAlmostEquals
14471450
:meth:`.assertNotAlmostEqual` failIfAlmostEqual assertNotAlmostEquals
14481451
:meth:`.assertRegex` assertRegexpMatches
1452+
:meth:`.assertNotRegex` assertNotRegexpMatches
14491453
:meth:`.assertRaisesRegex` assertRaisesRegexp
1450-
============================== ====================== ======================
1454+
============================== ====================== =======================
14511455

14521456
.. deprecated:: 3.1
14531457
the fail* aliases listed in the second column.
14541458
.. deprecated:: 3.2
14551459
the assert* aliases listed in the third column.
14561460
.. deprecated:: 3.2
14571461
``assertRegexpMatches`` and ``assertRaisesRegexp`` have been renamed to
1458-
:meth:`.assertRegex` and :meth:`.assertRaisesRegex`
1459-
1462+
:meth:`.assertRegex` and :meth:`.assertRaisesRegex`.
1463+
.. deprecated:: 3.5
1464+
the ``assertNotRegexpMatches`` name in favor of :meth:`.assertNotRegex`.
14601465

14611466
.. _testsuite-objects:
14621467

Doc/whatsnew/3.7.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,9 @@ Optimizations
234234
expressions <re>`. Searching some patterns can now be up to 20 times faster.
235235
(Contributed by Serhiy Storchaka in :issue:`30285`.)
236236

237+
* :meth:`selectors.EpollSelector.modify`, :meth:`selectors.PollSelector.modify`
238+
and :meth:`selectors.DevpollSelector.modify` may be around 10% faster under
239+
heavy loads. (Contributed by Giampaolo Rodola' in :issue:`30014`)
237240

238241
Build and C API Changes
239242
=======================

Lib/asyncio/locks.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ def acquire(self):
176176
yield from fut
177177
self._locked = True
178178
return True
179+
except futures.CancelledError:
180+
if not self._locked:
181+
self._wake_up_first()
182+
raise
179183
finally:
180184
self._waiters.remove(fut)
181185

@@ -192,14 +196,17 @@ def release(self):
192196
"""
193197
if self._locked:
194198
self._locked = False
195-
# Wake up the first waiter who isn't cancelled.
196-
for fut in self._waiters:
197-
if not fut.done():
198-
fut.set_result(True)
199-
break
199+
self._wake_up_first()
200200
else:
201201
raise RuntimeError('Lock is not acquired.')
202202

203+
def _wake_up_first(self):
204+
"""Wake up the first waiter who isn't cancelled."""
205+
for fut in self._waiters:
206+
if not fut.done():
207+
fut.set_result(True)
208+
break
209+
203210

204211
class Event:
205212
"""Asynchronous equivalent to threading.Event.

Lib/asyncio/proactor_events.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,9 @@ class _ProactorBaseWritePipeTransport(_ProactorBasePipeTransport,
227227

228228
def write(self, data):
229229
if not isinstance(data, (bytes, bytearray, memoryview)):
230-
raise TypeError('data argument must be byte-ish (%r)',
231-
type(data))
230+
msg = ("data argument must be a bytes-like object, not '%s'" %
231+
type(data).__name__)
232+
raise TypeError(msg)
232233
if self._eof_written:
233234
raise RuntimeError('write_eof() already called')
234235

0 commit comments

Comments
 (0)