cpython/Misc
Miss Islington (bot) d8948c5e09
bpo-32751: Wait for task cancellation in asyncio.wait_for() (GH-7216)
Currently, asyncio.wait_for(fut), upon reaching the timeout deadline,
cancels the future and returns immediately.  This is problematic for
when *fut* is a Task, because it will be left running for an arbitrary
amount of time.  This behavior is iself surprising and may lead to
related bugs such as the one described in bpo-33638:

    condition = asyncio.Condition()
    async with condition:
        await asyncio.wait_for(condition.wait(), timeout=0.5)

Currently, instead of raising a TimeoutError, the above code will fail
with `RuntimeError: cannot wait on un-acquired lock`, because
`__aexit__` is reached _before_ `condition.wait()` finishes its
cancellation and re-acquires the condition lock.

To resolve this, make `wait_for` await for the task cancellation.
The tradeoff here is that the `timeout` promise may be broken if the
task decides to handle its cancellation in a slow way.  This represents
a behavior change and should probably not be back-patched to 3.6 and
earlier.
(cherry picked from commit e2b340ab41)

Co-authored-by: Elvis Pranskevichus <elvis@magic.io>
2018-05-29 15:37:06 -07:00
..
NEWS.d bpo-32751: Wait for task cancellation in asyncio.wait_for() (GH-7216) 2018-05-29 15:37:06 -07:00
ACKS bpo-33542: Ignore DUID in uuid.get_node on Windows. (GH-6922) 2018-05-20 08:40:10 -07:00
HISTORY s/the the/the/ (GH-6287) 2018-03-28 06:23:32 -07:00
Porting
README
README.AIX
README.coverity
README.valgrind
SpecialBuilds.txt
coverity_model.c
gdbinit [3.7] bpo-29673: fix gdb scripts pystack and pystackv (GH-6126) (GH-6399) 2018-04-06 18:14:29 -04:00
indent.pro
python-config.in
python-config.sh.in
python-wing3.wpr
python-wing4.wpr
python-wing5.wpr
python.man bpo-17232: Clarify docs for -O and -OO command line options (GH-5839) 2018-02-24 19:24:08 -08:00
python.pc.in
svnmap.txt
valgrind-python.supp bpo-32889: update valgrind suppressions (GH-5779) 2018-02-20 22:27:38 -08:00
vgrindefs

README

Python Misc subdirectory
========================

This directory contains files that wouldn't fit in elsewhere.  Some
documents are only of historic importance.

Files found here
----------------

ACKS                    Acknowledgements
gdbinit                 Handy stuff to put in your .gdbinit file, if you use gdb
HISTORY                 News from previous releases -- oldest last
indent.pro              GNU indent profile approximating my C style
NEWS                    News for this release (for some meaning of "this")
Porting                 Mini-FAQ on porting to new platforms
python-config.in        Python script template for python-config
python.man              UNIX man page for the python interpreter
python.pc.in            Package configuration info template for pkg-config
python-wing*.wpr        Wing IDE project file
README                  The file you're reading now
README.AIX              Information about using Python on AIX
README.coverity         Information about running Coverity's Prevent on Python
README.valgrind         Information for Valgrind users, see valgrind-python.supp
SpecialBuilds.txt       Describes extra symbols you can set for debug builds
svnmap.txt              Map of old SVN revs and branches to hg changeset ids,
                        help history-digging
valgrind-python.supp    Valgrind suppression file, see README.valgrind
vgrindefs               Python configuration for vgrind (a generic pretty printer)