cpython/Lib
Yury Selivanov 5376ba9630 Issue #24400: Introduce a distinct type for 'async def' coroutines.
Summary of changes:

1. Coroutines now have a distinct, separate from generators
   type at the C level: PyGen_Type, and a new typedef PyCoroObject.
   PyCoroObject shares the initial segment of struct layout with
   PyGenObject, making it possible to reuse existing generators
   machinery.  The new type is exposed as 'types.CoroutineType'.

   As a consequence of having a new type, CO_GENERATOR flag is
   no longer applied to coroutines.

2. Having a separate type for coroutines made it possible to add
   an __await__ method to the type.  Although it is not used by the
   interpreter (see details on that below), it makes coroutines
   naturally (without using __instancecheck__) conform to
   collections.abc.Coroutine and collections.abc.Awaitable ABCs.

   [The __instancecheck__ is still used for generator-based
   coroutines, as we don't want to add __await__ for generators.]

3. Add new opcode: GET_YIELD_FROM_ITER.  The opcode is needed to
   allow passing native coroutines to the YIELD_FROM opcode.

   Before this change, 'yield from o' expression was compiled to:

      (o)
      GET_ITER
      LOAD_CONST
      YIELD_FROM

   Now, we use GET_YIELD_FROM_ITER instead of GET_ITER.

   The reason for adding a new opcode is that GET_ITER is used
   in some contexts (such as 'for .. in' loops) where passing
   a coroutine object is invalid.

4. Add two new introspection functions to the inspec module:
   getcoroutinestate(c) and getcoroutinelocals(c).

5. inspect.iscoroutine(o) is updated to test if 'o' is a native
   coroutine object.  Before this commit it used abc.Coroutine,
   and it was requested to update inspect.isgenerator(o) to use
   abc.Generator; it was decided, however, that inspect functions
   should really be tailored for checking for native types.

6. sys.set_coroutine_wrapper(w) API is updated to work with only
   native coroutines.  Since types.coroutine decorator supports
   any type of callables now, it would be confusing that it does
   not work for all types of coroutines.

7. Exceptions logic in generators C implementation was updated
   to raise clearer messages for coroutines:

   Before: TypeError("generator raised StopIteration")
   After: TypeError("coroutine raised StopIteration")
2015-06-22 12:19:30 -04:00
..
asyncio Issue #24400: Introduce a distinct type for 'async def' coroutines. 2015-06-22 12:19:30 -04:00
collections Issue #23509: Speed up Counter operators 2015-05-29 22:14:07 -07:00
concurrent Issue #21817: When an exception is raised in a task submitted to a ProcessPoolExecutor, the remote traceback is now displayed in the parent process. 2015-01-17 20:02:14 +01:00
ctypes Issue #23911: Fix ctypes test on Windows. 2015-05-13 00:34:39 -05:00
curses
dbm Issue #23865: close() methods in multiple modules now are idempotent and more 2015-04-10 13:29:28 +03:00
distutils merge 3.4 2015-05-25 21:25:09 -05:00
email Issue #21448: Improve performance of the email feedparser 2015-05-22 17:23:28 -07:00
encodings Added forgotten new files for issues #22681 and #22682. 2015-05-13 00:34:53 +03:00
ensurepip Upgrade pip to 7.0.3 and setuptools to 17.0 2015-06-02 11:39:31 -04:00
html Issue #23181: More "codepoint" -> "code point". 2015-01-18 11:33:31 +02:00
http merge 3.4 (#22931) 2015-05-23 10:41:30 -05:00
idlelib Update idlelib/NEWS.txt 2015-05-23 17:24:22 -04:00
importlib Issue #24400: Introduce a distinct type for 'async def' coroutines. 2015-06-22 12:19:30 -04:00
json Issue #19361: JSON decoder now raises JSONDecodeError instead of ValueError. 2015-01-26 13:16:30 +02:00
lib2to3 Issue #22064: Improve the misleading message from 2to3 when skipping optional fixers. 2015-05-13 13:40:12 +03:00
logging Issue #23865: close() methods in multiple modules now are idempotent and more 2015-04-10 13:29:28 +03:00
msilib Issue #23731: Implement PEP 488. 2015-04-13 14:21:02 -04:00
multiprocessing Issue #21116: Avoid blowing memory when allocating a multiprocessing shared 2015-04-13 20:53:43 +02:00
plat-aix4
plat-darwin
plat-freebsd4
plat-freebsd5
plat-freebsd6
plat-freebsd7
plat-freebsd8
plat-generic
plat-linux
plat-netbsd1
plat-next3
plat-sunos5
plat-unixware7
pydoc_data Regenerated pydoc topic index in preparation for Python 3.5.0b2. 2015-05-30 16:58:27 -07:00
site-packages
sqlite3 Issue #24257: Fixed incorrect uses of PyObject_IsInstance(). 2015-05-22 11:13:20 +03:00
test Issue #24400: Introduce a distinct type for 'async def' coroutines. 2015-06-22 12:19:30 -04:00
tkinter Issue #24408: Fixed test for tkinter.Font on OS X. 2015-06-21 14:42:57 +03:00
turtledemo issue19075: add visual sorting algorithms to turtledemo; original code from Jason Yeo 2015-03-02 12:29:58 -08:00
unittest Issue #15836: assertRaises(), assertRaisesRegex(), assertWarns() and 2015-05-21 20:15:40 +03:00
urllib Issue #13866: add *quote_via* argument to urlencode. 2015-05-17 20:44:50 -04:00
venv Issue #23399: pyvenv creates relative symlinks where possible. 2015-02-06 11:23:58 -05:00
wsgiref Merge from 3.4 2014-09-17 16:32:46 +08:00
xml PEP 0492 -- Coroutines with async and await syntax. Issue #24017. 2015-05-11 22:57:16 -04:00
xmlrpc Issue #23865: close() methods in multiple modules now are idempotent and more 2015-04-10 13:29:28 +03:00
__future__.py PEP 479: Change StopIteration handling inside generators. 2015-05-09 11:44:30 -04:00
__phello__.foo.py
_bootlocale.py
_collections_abc.py Issue #24400: Introduce a distinct type for 'async def' coroutines. 2015-06-22 12:19:30 -04:00
_compat_pickle.py Issue #18473: Fixed pickle compatibility tests for optional modules. 2015-03-31 16:49:26 +03:00
_compression.py Issue #23529: Limit the size of decompressed data when reading from 2015-04-11 00:31:01 +02:00
_dummy_thread.py Issue 21137: Better repr for threading.Lock() 2014-05-25 18:22:35 -07:00
_markupbase.py
_osx_support.py Issue #21811: Anticipated fixes to 3.x and 2.7 for OS X 10.10 Yosemite. 2014-06-25 13:36:14 -07:00
_pydecimal.py Issue #23641: Cleaned out legacy dunder names from tests and docs. 2015-03-12 22:01:30 +02:00
_pyio.py Issue #22982: Improve BOM handling when seeking to multiple positions of a writable text file. 2015-04-13 20:02:33 +02:00
_sitebuiltins.py #9364: Improve the text printed by help(pydoc) and help(help). 2014-04-19 12:59:30 -04:00
_strptime.py Fixed using deprecated escaping in regular expression in _strptime.py (issue23622). 2015-03-25 01:21:50 +02:00
_threading_local.py
_weakrefset.py
abc.py Issue #22032: __qualname__ instead of __name__ is now always used to format 2014-07-22 15:00:37 +03:00
aifc.py Issue #23865: close() methods in multiple modules now are idempotent and more 2015-04-10 13:24:41 +03:00
antigravity.py
argparse.py Issue #14910: Add allow_abbrev parameter to argparse.ArgumentParser. 2015-02-14 01:39:17 +02:00
ast.py
asynchat.py (Merge 3.4) Issue #16133: The asynchat.async_chat.handle_read() method now 2014-07-24 19:00:28 +02:00
asyncore.py Issue #23485: select.poll.poll() is now retried when interrupted by a signal 2015-03-30 21:38:00 +02:00
base64.py Escaped backslashes in docstrings. 2015-04-03 18:12:41 +03:00
bdb.py
binhex.py Issue #23865: close() methods in multiple modules now are idempotent and more 2015-04-10 13:29:28 +03:00
bisect.py
bz2.py Issue #23529: Limit the size of decompressed data when reading from 2015-04-11 00:31:01 +02:00
calendar.py
cgi.py merge 3.4 (#23801) 2015-03-29 16:45:19 -04:00
cgitb.py Issue #22831: Use "with" to avoid possible fd leaks. 2015-04-04 11:01:02 +03:00
chunk.py Issue #23865: close() methods in multiple modules now are idempotent and more 2015-04-10 13:24:41 +03:00
cmd.py
code.py Remaining fallout from 17911 2015-03-05 15:45:01 +13:00
codecs.py Escaped backslashes in docstrings. 2015-04-03 18:13:23 +03:00
codeop.py
colorsys.py
compileall.py Issue #23917: Fall back to sequential compilation when ProcessPoolExecutor doesn't exist. 2015-04-22 09:39:19 +03:00
configparser.py Closes #18159: ConfigParser getters not available on SectionProxy 2014-09-15 02:08:41 -07:00
contextlib.py PEP 479: Change StopIteration handling inside generators. 2015-05-09 11:44:30 -04:00
copy.py Issue #20289: The copy module now uses pickle protocol 4 (PEP 3154) and 2015-03-24 18:06:42 +02:00
copyreg.py
cProfile.py
crypt.py
csv.py Issue #23171: csv.Writer.writerow() now supports arbitrary iterables. 2015-03-30 09:09:54 +03:00
datetime.py Issue #23641: Cleaned out legacy dunder names from tests and docs. 2015-03-12 22:01:30 +02:00
decimal.py Issue #23641: Cleaned out legacy dunder names from tests and docs. 2015-03-12 21:56:08 +02:00
difflib.py Issue 24237: Raise PendingDeprecationWarning per PEP 479 2015-05-22 11:16:47 -04:00
dis.py PEP 0492 -- Coroutines with async and await syntax. Issue #24017. 2015-05-11 22:57:16 -04:00
doctest.py Issue #23731: Implement PEP 488. 2015-04-13 14:21:02 -04:00
dummy_threading.py
enum.py Close issue23900: add default __doc__ to new enumerations that do not specify one. 2015-04-11 23:23:06 -07:00
filecmp.py shallow defaults to 'True' not '1' (closes #21355) 2014-04-26 13:36:21 -04:00
fileinput.py Issue #23865: close() methods in multiple modules now are idempotent and more 2015-04-10 13:29:28 +03:00
fnmatch.py
formatter.py Fix module deprecation warnings to have a useful stacklevel 2015-03-27 12:56:57 -04:00
fractions.py Issue #22486: Added the math.gcd() function. The fractions.gcd() function now is 2015-05-13 00:19:51 +03:00
ftplib.py Issue #23865: close() methods in multiple modules now are idempotent and more 2015-04-10 13:29:28 +03:00
functools.py Backed out changeset: b0a0b9b59012 2015-05-24 21:53:49 +03:00
genericpath.py Issue #21883: os.path.join() and os.path.relpath() now raise a TypeError with 2014-10-04 14:58:43 +03:00
getopt.py
getpass.py #21169: add comment and doc update for getpass change. 2014-04-14 10:28:58 -04:00
gettext.py Merge from 3.4 2015-04-14 10:35:43 -04:00
glob.py Issue #13968: The glob module now supports recursive search in 2014-09-11 12:17:37 +03:00
gzip.py Issue #23529: Limit the size of decompressed data when reading from 2015-04-11 00:31:01 +02:00
hashlib.py Removed duplicated words in in comments and docs. 2014-12-01 18:28:43 +02:00
heapq.py Issue #22186: Fix typos in Lib/. 2014-10-19 18:07:05 +03:00
hmac.py
imaplib.py #21800: Add RFC 6855 support to imaplib. 2015-05-10 19:17:23 -04:00
imghdr.py #20295: Teach imghdr to recognize OpenEXR format images. 2014-06-26 12:27:57 -04:00
imp.py PEP 489: Multi-phase extension module initialization 2015-05-23 22:24:10 +10:00
inspect.py Issue #24400: Introduce a distinct type for 'async def' coroutines. 2015-06-22 12:19:30 -04:00
io.py #21225: copy docstrings from base classes 2014-04-25 09:29:30 -04:00
ipaddress.py Issue #16261: Converted some bare except statements to except statements 2015-05-20 10:33:40 +03:00
keyword.py
linecache.py Issue #23838: linecache now clears the cache and returns an empty result on 2015-04-01 16:56:13 +03:00
locale.py Issue #22681: Added support for the koi8_t encoding. 2015-05-12 23:24:19 +03:00
lzma.py Issue #23529: Limit the size of decompressed data when reading from 2015-04-11 00:31:01 +02:00
macpath.py Issue #23780: Improved error message in os.path.join() with single argument. 2015-05-19 11:00:07 +03:00
macurl2path.py
mailbox.py Issue #23865: close() methods in multiple modules now are idempotent and more 2015-04-10 13:29:28 +03:00
mailcap.py
mimetypes.py Issue #22028: Ensure mimetypes will not open registry keys with embedded nulls 2015-03-10 13:17:21 -07:00
modulefinder.py Issue #23911: Move path-based bootstrap code to a separate frozen module. 2015-05-02 19:15:18 -06:00
netrc.py
nntplib.py Issue #22351: The nntplib.NNTP constructor no longer leaves the connection 2015-03-21 09:40:26 +02:00
ntpath.py Issue #23780: Improved error message in os.path.join() with single argument. 2015-05-19 11:00:07 +03:00
nturl2path.py
numbers.py Issue #21408: The default __ne__() now returns NotImplemented if __eq__() 2015-01-26 09:57:07 +02:00
opcode.py Issue #24400: Introduce a distinct type for 'async def' coroutines. 2015-06-22 12:19:30 -04:00
operator.py added matmul and imatmul to operator.__all__ 2015-06-07 19:21:01 +03:00
optparse.py
os.py merge 3.4 (#23929) 2015-04-13 20:25:11 -04:00
pathlib.py Issue #23146: Fix mishandling of absolute Windows paths with forward slashes in pathlib. 2015-02-15 18:06:54 +01:00
pdb.py Issue #22186: Fix typos in Lib/. 2014-10-19 18:07:05 +03:00
pickle.py Issue #23611: Serializing more "lookupable" objects (such as unbound methods 2015-03-31 14:07:24 +03:00
pickletools.py Issue #19858: pickletools.optimize() now aware of the MEMOIZE opcode, can 2014-12-16 18:00:56 +02:00
pipes.py
pkgutil.py Issue #20383: Introduce importlib.util.module_from_spec(). 2014-05-30 14:55:29 -04:00
platform.py Issue #24210: Silence a PendingDeprecationWarning warning in platform.platform(). 2015-05-16 20:24:28 +03:00
plistlib.py Issue #21888: plistlib's load() and loads() now work if the fmt parameter is 2014-07-23 18:49:31 +03:00
poplib.py #21804: Add RFC 6856 (UTF8) support to poplib. 2015-05-16 15:05:53 -04:00
posixpath.py Issue #23780: Improved error message in os.path.join() with single argument. 2015-05-19 11:00:07 +03:00
pprint.py Issue #18682: Optimized pprint functions for builtin scalar types. 2015-05-16 21:38:05 +03:00
profile.py
pstats.py
pty.py
py_compile.py Issue #23911: Move path-based bootstrap code to a separate frozen module. 2015-05-02 19:15:18 -06:00
pyclbr.py
pydoc.py Issue #23911: Move path-based bootstrap code to a separate frozen module. 2015-05-02 19:15:18 -06:00
queue.py Issue #22043: time.monotonic() is now always available 2014-09-02 23:18:25 +02:00
quopri.py Issue #23681: Fixed Python 2 to 3 poring bugs. 2015-03-20 16:46:19 +02:00
random.py merge 2014-05-25 17:28:38 -07:00
re.py Issue #22364: Improved some re error messages using regex for hints. 2015-03-25 21:03:47 +02:00
reprlib.py Issue #22824: Simplify reprlib output format for empty arrays 2014-11-15 10:58:58 -08:00
rlcompleter.py
runpy.py Issue #23911: Move path-based bootstrap code to a separate frozen module. 2015-05-02 19:15:18 -06:00
sched.py Issue #23326: Removed __ne__ implementations. Since fixing default __ne__ 2015-01-31 12:05:05 +02:00
selectors.py asyncio: Sync with github repo 2015-05-11 13:48:16 -04:00
shelve.py Issue #23865: close() methods in multiple modules now are idempotent and more 2015-04-10 13:24:41 +03:00
shlex.py Issue #24113: Remove unreachable code in shlex. 2015-05-04 22:45:47 -04:00
shutil.py Issue #21775: shutil.copytree(): fix crash when copying to VFAT 2014-12-10 02:51:36 +02:00
signal.py issue23673 2015-03-18 17:27:57 -07:00
site.py Issue #23911: Move path-based bootstrap code to a separate frozen module. 2015-05-02 19:15:18 -06:00
smtpd.py #21795: advertise 8BITMIME if decode_data is False. 2015-05-11 12:11:40 -04:00
smtplib.py #24218: Add SMTPUTF8 support to send_message. 2015-05-17 19:27:22 -04:00
sndhdr.py #18615: Make sndhdr return namedtuples. 2014-10-09 16:59:30 -04:00
socket.py issue23673 2015-03-18 18:19:30 -07:00
socketserver.py Issue #23285: PEP 475 -- Retry system calls failing with EINTR. 2015-02-07 13:27:50 +00:00
sre_compile.py Issue #22364: Improved some re error messages using regex for hints. 2015-03-25 21:03:47 +02:00
sre_constants.py Issue #22831: Use "with" to avoid possible fd leaks. 2015-04-04 11:01:02 +03:00
sre_parse.py Issue #14260: The groupindex attribute of regular expression pattern object 2015-03-30 01:01:48 +03:00
ssl.py issue23673 2015-03-18 17:27:57 -07:00
stat.py Issue #21741: Add st_file_attributes to os.stat_result on Windows. 2014-06-19 09:46:37 -05:00
statistics.py Issue #22823: Use set literals instead of creating a set from a list 2014-11-09 15:56:33 -08:00
string.py Reverting my previous commit. 2015-05-30 10:57:56 -04:00
stringprep.py
struct.py
subprocess.py Add a subprocess.run() function than returns a CalledProcess instance for a 2015-04-14 16:14:25 -07:00
sunau.py Issue #23865: close() methods in multiple modules now are idempotent and more 2015-04-10 13:24:41 +03:00
symbol.py Issue 24297: Update symbol.py. See also issue 24017. 2015-05-27 11:08:19 -04:00
symtable.py remove the concept of an unoptimized function scope from the compiler, since it can't happen anymore 2015-04-27 21:44:22 -04:00
sysconfig.py Closes #23437: Make user scripts directory versioned on Windows (patch by pmoore) 2015-02-14 09:50:59 -08:00
tabnanny.py
tarfile.py tarfile.open() with mode 'x' created files without an end of archive marker. 2015-05-27 12:53:44 +02:00
telnetlib.py Issue #23865: close() methods in multiple modules now are idempotent and more 2015-04-10 13:29:28 +03:00
tempfile.py Issue 24230: The tempfile module now accepts bytes for prefix, suffix and dir 2015-05-22 16:18:14 -07:00
textwrap.py Escaped backslashes in docstrings. 2015-04-03 18:13:23 +03:00
this.py
threading.py Merge: #11866: Eliminate race condition in the computation of names for new threads. 2014-10-04 17:45:15 -04:00
timeit.py Issue #5633: Fixed timeit when the statement is a string and the setup is not. 2015-05-30 19:44:55 +03:00
token.py PEP 0492 -- Coroutines with async and await syntax. Issue #24017. 2015-05-11 22:57:16 -04:00
tokenize.py (Merge 3.5) Issue #23840: tokenize.open() now closes the temporary binary file 2015-05-26 00:46:44 +02:00
trace.py Issue #23731: Implement PEP 488. 2015-04-13 14:21:02 -04:00
traceback.py Issue #22619: Added negative limit support in the traceback module. 2015-05-03 13:19:46 +03:00
tracemalloc.py Issue #23731: Implement PEP 488. 2015-04-13 14:21:02 -04:00
tty.py
turtle.py Issue #6639: Module-level turtle functions no longer raise TclError after 2015-02-22 17:25:33 +02:00
types.py Issue #24400: Introduce a distinct type for 'async def' coroutines. 2015-06-22 12:19:30 -04:00
typing.py Preliminary typing.py, anticipating provisional acceptance of PEP 484. 2015-05-22 10:14:11 -07:00
uu.py
uuid.py Issue #16261: Converted some bare except statements to except statements 2015-05-20 10:33:40 +03:00
warnings.py Issue #23731: Implement PEP 488. 2015-04-13 14:21:02 -04:00
wave.py Issue #23865: close() methods in multiple modules now are idempotent and more 2015-04-10 13:24:41 +03:00
weakref.py Closes #21173: Fix len() on a WeakKeyDictionary when .clear() was called with an iterator alive. 2014-10-05 20:04:06 +02:00
webbrowser.py Issue #8232: Renamed WinFireFox to WinFirefox 2015-06-15 09:11:14 -07:00
xdrlib.py Issue #11694: Raise ConversionError in xdrlib as documented 2014-10-10 21:21:52 +03:00
zipapp.py #23657 Don't explicitly do an isinstance check for str in zipapp 2015-03-22 15:32:36 +00:00
zipfile.py Issue #23731: Implement PEP 488. 2015-04-13 14:21:02 -04:00