blob: 6d07869554a15799ff3aeed5a1d2672575908830 [file] [log] [blame]
Zachary Ware569db2c2015-05-22 11:42:20 -05001****************************
Victor Stinner01adf062014-03-18 00:53:32 +01002 What's New In Python 3.5
3****************************
4
5:Release: |release|
6:Date: |today|
7
Yury Selivanovdfcfe132015-09-08 15:33:15 -04008:Author: Elvis Pranskevichus <elprans@gmail.com> (Editor)
9
Victor Stinner01adf062014-03-18 00:53:32 +010010.. Rules for maintenance:
11
12 * Anyone can add text to this document. Do not spend very much time
13 on the wording of your changes, because your text will probably
14 get rewritten to some degree.
15
16 * The maintainer will go through Misc/NEWS periodically and add
17 changes; it's therefore more important to add your changes to
18 Misc/NEWS than to this file.
19
20 * This is not a complete list of every single change; completeness
21 is the purpose of Misc/NEWS. Some changes I consider too small
22 or esoteric to include. If such a change is added to the text,
23 I'll just remove it. (This is another reason you shouldn't spend
24 too much time on writing your addition.)
25
26 * If you want to draw your new text to the attention of the
27 maintainer, add 'XXX' to the beginning of the paragraph or
28 section.
29
30 * It's OK to just add a fragmentary note about a change. For
31 example: "XXX Describe the transmogrify() function added to the
32 socket module." The maintainer will research the change and
33 write the necessary text.
34
35 * You can comment out your additions if you like, but it's not
36 necessary (especially when a final release is some months away).
37
38 * Credit the author of a patch or bugfix. Just the name is
39 sufficient; the e-mail address isn't necessary.
40
41 * It's helpful to add the bug/patch number as a comment:
42
43 XXX Describe the transmogrify() function added to the socket
44 module.
45 (Contributed by P.Y. Developer in :issue:`12345`.)
46
47 This saves the maintainer the effort of going through the Mercurial log
48 when researching a change.
49
50This article explains the new features in Python 3.5, compared to 3.4.
51
52For full details, see the :source:`Misc/NEWS` file.
53
Benjamin Peterson52d14932015-03-27 16:07:35 -040054.. note::
55
56 Prerelease users should be aware that this document is currently in draft
57 form. It will be updated substantially as Python 3.5 moves towards release,
58 so it's worth checking back even after reading earlier versions.
Victor Stinner01adf062014-03-18 00:53:32 +010059
60
61.. seealso::
62
Berker Peksagfa0423b2014-10-09 11:38:19 +030063 :pep:`478` - Python 3.5 Release Schedule
Victor Stinner01adf062014-03-18 00:53:32 +010064
65
66Summary -- Release highlights
67=============================
68
Victor Stinner93692bb2015-03-30 15:04:45 +020069.. This section singles out the most important changes in Python 3.5.
Victor Stinner01adf062014-03-18 00:53:32 +010070 Brevity is key.
71
72New syntax features:
73
Benjamin Peterson14ef1a12015-05-13 11:19:27 -040074* :pep:`465`, a new matrix multiplication operator: ``a @ b``.
75* :pep:`492`, coroutines with async and await syntax.
Yury Selivanova5a00622015-08-04 12:52:16 -040076* :pep:`448`, additional unpacking generalizations.
Victor Stinner01adf062014-03-18 00:53:32 +010077
78New library modules:
79
Brett Cannoncc4dfc12015-03-13 10:40:49 -040080* :mod:`zipapp`: :ref:`Improving Python ZIP Application Support
81 <whatsnew-zipapp>` (:pep:`441`).
Victor Stinner01adf062014-03-18 00:53:32 +010082
83New built-in features:
84
Victor Stinner93692bb2015-03-30 15:04:45 +020085* ``bytes % args``, ``bytearray % args``: :pep:`461` - Adding ``%`` formatting
86 to bytes and bytearray
Gregory P. Smith8cb65692015-04-25 23:22:26 +000087* ``b'\xf0\x9f\x90\x8d'.hex()``, ``bytearray(b'\xf0\x9f\x90\x8d').hex()``,
88 ``memoryview(b'\xf0\x9f\x90\x8d').hex()``: :issue:`9951` - A ``hex`` method
89 has been added to bytes, bytearray, and memoryview.
Yury Selivanove13f8f32015-07-03 00:23:30 -040090* Generators have new ``gi_yieldfrom`` attribute, which returns the
91 object being iterated by ``yield from`` expressions. (Contributed
92 by Benno Leslie and Yury Selivanov in :issue:`24450`.)
Yury Selivanovf488fb42015-07-03 01:04:23 -040093* New :exc:`RecursionError` exception. (Contributed by Georg Brandl
94 in :issue:`19235`.)
Victor Stinner01adf062014-03-18 00:53:32 +010095
96Implementation improvements:
97
Victor Stinner71430292014-03-18 01:18:21 +010098* When the ``LC_TYPE`` locale is the POSIX locale (``C`` locale),
99 :py:data:`sys.stdin` and :py:data:`sys.stdout` are now using the
100 ``surrogateescape`` error handler, instead of the ``strict`` error handler
101 (:issue:`19977`).
Victor Stinner01adf062014-03-18 00:53:32 +0100102
Brett Cannonf299abd2015-04-13 14:21:02 -0400103* :pep:`488`, the elimination of ``.pyo`` files.
Nick Coghland5cacbb2015-05-23 22:24:10 +1000104* :pep:`489`, multi-phase initialization of extension modules.
Brett Cannonf299abd2015-04-13 14:21:02 -0400105
Victor Stinner01adf062014-03-18 00:53:32 +0100106Significantly Improved Library Modules:
107
Yury Selivanov58444362015-05-30 10:49:09 -0400108* :class:`collections.OrderedDict` is now implemented in C, which improves
109 its performance between 4x to 100x times. Contributed by Eric Snow in
110 :issue:`16991`.
111
Gregory P. Smithad577b92015-05-22 16:18:14 -0700112* You may now pass bytes to the :mod:`tempfile` module's APIs and it will
113 return the temporary pathname as bytes instead of str. It also accepts
114 a value of ``None`` on parameters where only str was accepted in the past to
115 do the right thing based on the types of the other inputs. Two functions,
116 :func:`gettempdirb` and :func:`gettempprefixb`, have been added to go along
117 with this. This behavior matches that of the :mod:`os` APIs.
Victor Stinner01adf062014-03-18 00:53:32 +0100118
Yury Selivanov7d6adab2015-08-05 19:01:51 -0400119* :mod:`ssl` module gained support for Memory BIO, which decouples SSL
120 protocol handling from network IO. (Contributed by Geert Jansen in
121 :issue:`21965`.)
122
Victor Stinner01adf062014-03-18 00:53:32 +0100123Security improvements:
124
125* None yet.
126
Steve Dower313fbf42015-07-17 16:48:48 -0700127Windows improvements:
128
129* A new installer for Windows has replaced the old MSI. See :ref:`using-on-windows`
130 for more information.
131* Windows builds now use Microsoft Visual C++ 14.0, and extension modules
132 should use the same.
133
134
Victor Stinner01adf062014-03-18 00:53:32 +0100135Please read on for a comprehensive list of user-facing changes.
136
137
138.. PEP-sized items next.
139
140.. _pep-4XX:
141
142.. PEP 4XX: Virtual Environments
143.. =============================
144
145
146.. (Implemented by Foo Bar.)
147
148.. .. seealso::
149
150 :pep:`4XX` - Python Virtual Environments
151 PEP written by Carl Meyer
152
153
Yury Selivanovdfcfe132015-09-08 15:33:15 -0400154New Features
155============
156
157.. _whatsnew-pep-492:
158
Yury Selivanovf3e40fa2015-05-21 11:50:30 -0400159PEP 492 - Coroutines with async and await syntax
160------------------------------------------------
161
Yury Selivanovdfcfe132015-09-08 15:33:15 -0400162:pep:`492` greatly improves support for asynchronous programming in Python
163by adding :term:`awaitable objects <awaitable>`,
164:term:`coroutine functions <coroutine function>`,
165:term:`asynchronous iteration <asynchronous iterable>`,
166and :term:`asynchronous context managers <asynchronous context manager>`.
Yury Selivanovf3e40fa2015-05-21 11:50:30 -0400167
Yury Selivanovdfcfe132015-09-08 15:33:15 -0400168Coroutine functions are declared using the new :keyword:`async def` syntax::
Yury Selivanovf3e40fa2015-05-21 11:50:30 -0400169
Yury Selivanovdfcfe132015-09-08 15:33:15 -0400170 >>> async def coro():
171 ... return 'spam'
Yury Selivanovf3e40fa2015-05-21 11:50:30 -0400172
Yury Selivanovdfcfe132015-09-08 15:33:15 -0400173Inside a coroutine function, a new :keyword:`await` expression can be used
174to suspend coroutine execution until the result is available. Any object
175can be *awaited*, as long as it implements the :term:`awaitable` protocol by
176defining the :meth:`__await__` method.
177
178PEP 492 also adds :keyword:`async for` statement for convenient iteration
179over asynchronous iterables.
180
181An example of a simple HTTP client written using the new syntax::
182
183 import asyncio
184
185 async def http_get(domain):
186 reader, writer = await asyncio.open_connection(domain, 80)
187
188 writer.write(b'\r\n'.join([
189 b'GET / HTTP/1.1',
190 b'Host: %b' % domain.encode('latin-1'),
191 b'Connection: close',
192 b'', b''
193 ]))
194
195 async for line in reader:
196 print('>>>', line)
197
198 writer.close()
199
200 loop = asyncio.get_event_loop()
201 try:
202 loop.run_until_complete(http_get('example.com'))
203 finally:
204 loop.close()
205
206
207Similarly to asynchronous iteration, there is a new syntax for asynchronous
208context managers::
209
210 >>> import asyncio
211 >>> async def coro1(lock):
212 ... print('coro1: waiting for lock')
213 ... async with lock:
214 ... print('coro1: holding the lock')
215 ... await asyncio.sleep(1)
216 ... print('coro1: releasing the lock')
217 ...
218 >>> async def coro2(lock):
219 ... print('coro2: waiting for lock')
220 ... async with lock:
221 ... print('coro2: holding the lock')
222 ... await asyncio.sleep(1)
223 ... print('coro2: releasing the lock')
224 ...
225 >>> loop = asyncio.get_event_loop()
226 >>> lock = asyncio.Lock()
227 >>> coros = asyncio.gather(coro1(lock), coro2(lock), loop=loop)
228 >>> loop.run_until_complete(coros)
229 coro1: waiting for lock
230 coro1: holding the lock
231 coro2: waiting for lock
232 coro1: releasing the lock
233 coro2: holding the lock
234 coro2: releasing the lock
235 >>> loop.close()
236
237Note that both :keyword:`async for` and :keyword:`async with` can only
238be used inside a coroutine function declared with :keyword:`async def`.
239
240Coroutine functions are intended to be ran inside a compatible event loop,
241such as :class:`asyncio.Loop`.
Yury Selivanovf3e40fa2015-05-21 11:50:30 -0400242
243.. seealso::
244
245 :pep:`492` -- Coroutines with async and await syntax
Yury Selivanovdfcfe132015-09-08 15:33:15 -0400246 PEP written and implemented by Yury Selivanov.
Yury Selivanovf3e40fa2015-05-21 11:50:30 -0400247
248
Yury Selivanovdfcfe132015-09-08 15:33:15 -0400249PEP 465 - A dedicated infix operator for matrix multiplication
250--------------------------------------------------------------
Victor Stinner93692bb2015-03-30 15:04:45 +0200251
Yury Selivanovdfcfe132015-09-08 15:33:15 -0400252:pep:`465` adds the ``@`` infix operator for matrix multiplication.
253Currently, no builtin Python types implement the new operator, however, it
254can be implemented by defining :meth:`__matmul__`, :meth:`__rmatmul__`,
255and :meth:`__imatmul__` for regular, reflected, and in-place matrix
256multiplication. The semantics of these methods is similar to that of
257methods defining other infix arithmetic operators.
258
259Matrix multiplication is a notably common operation in many fields of
260mathematics, science, engineering, and the addition of ``@`` allows writing
261cleaner code::
262
263 >>> S = (H @ beta - r).T @ inv(H @ V @ H.T) @ (H @ beta - r)
264
265An upcoming release of NumPy 1.10 will add support for the new operator::
266
267 >>> import numpy
268
269 >>> x = numpy.ones(3)
270 >>> x
271 array([ 1., 1., 1.])
272
273 >>> m = numpy.eye(3)
274 >>> m
275 array([[ 1., 0., 0.],
276 [ 0., 1., 0.],
277 [ 0., 0., 1.]])
278
279 >>> x @ m
280 array([ 1., 1., 1.])
281
282
283.. seealso::
284
285 :pep:`465` -- A dedicated infix operator for matrix multiplication
286 PEP written by Nathaniel J. Smith; implemented by Benjamin Peterson.
287
288
289PEP 448 - Additional Unpacking Generalizations
290----------------------------------------------
291
292:pep:`448` extends the allowed uses of the ``*`` iterable unpacking
293operator and ``**`` dictionary unpacking operator. It is now possible
294to use an arbitrary number of unpackings in function calls::
295
296 >>> print(*[1], *[2], 3, *[4, 5])
297 1 2 3 4 5
298
299 >>> def fn(a, b, c, d):
300 ... print(a, b, c, d)
301 ...
302
303 >>> fn(**{'a': 1, 'c': 3}, **{'b': 2, 'd': 4})
304 1 2 3 4
305
306Similarly, tuple, list, set, and dictionary displays allow multiple
307unpackings::
308
309 >>> *range(4), 4
310 (0, 1, 2, 3, 4)
311 >>> [*range(4), 4]
312 [0, 1, 2, 3, 4]
313 >>> {*range(4), 4, *(5, 6, 7)}
314 {0, 1, 2, 3, 4, 5, 6, 7}
315 >>> {'x': 1, **{'y': 2}}
316 {'x': 1, 'y': 2}
317
318.. seealso::
319
320 :pep:`448` -- Additional Unpacking Generalizations
321 PEP written by Joshua Landau; implemented by Neil Girdhar,
322 Thomas Wouters, and Joshua Landau.
323
324
325PEP 461 - % formatting support for bytes and bytearray
326------------------------------------------------------
327
328PEP 461 adds % formatting to :class:`bytes` and :class:`bytearray`, aiding in
329handling data that is a mixture of binary and ASCII compatible text. This
330feature also eases porting such code from Python 2.
Victor Stinner93692bb2015-03-30 15:04:45 +0200331
332Examples::
333
334 >>> b'Hello %s!' % b'World'
335 b'Hello World!'
336 >>> b'x=%i y=%f' % (1, 2.5)
337 b'x=1 y=2.500000'
338
339Unicode is not allowed for ``%s``, but it is accepted by ``%a`` (equivalent of
340``repr(obj).encode('ascii', 'backslashreplace')``)::
341
342 >>> b'Hello %s!' % 'World'
343 Traceback (most recent call last):
344 File "<stdin>", line 1, in <module>
345 TypeError: %b requires bytes, or an object that implements __bytes__, not 'str'
346 >>> b'price: %a' % '10€'
347 b"price: '10\\u20ac'"
348
349.. seealso::
350
351 :pep:`461` -- Adding % formatting to bytes and bytearray
Yury Selivanovdfcfe132015-09-08 15:33:15 -0400352 PEP written by Ethan Furman; implemented by Neil Schemenauer and
353 Ethan Furman.
Yury Selivanov216d9992015-08-04 12:42:20 -0400354
355
Yury Selivanov5df36af2015-08-04 12:46:57 -0400356PEP 484 - Type Hints
357--------------------
358
359This PEP introduces a provisional module to provide these standard
360definitions and tools, along with some conventions for situations
361where annotations are not available.
362
363For example, here is a simple function whose argument and return type
364are declared in the annotations::
365
Yury Selivanovdfcfe132015-09-08 15:33:15 -0400366 def greeting(name: str) -> str:
367 return 'Hello ' + name
Yury Selivanov5df36af2015-08-04 12:46:57 -0400368
369The type system supports unions, generic types, and a special type
370named ``Any`` which is consistent with (i.e. assignable to and from) all
371types.
372
373.. seealso::
374
Yury Selivanov40c0ce42015-08-05 12:46:29 -0400375 * :mod:`typing` module documentation
Yury Selivanovdfcfe132015-09-08 15:33:15 -0400376 * :pep:`484` -- Type Hints
377 PEP written by Guido van Rossum, Jukka Lehtosalo, and Łukasz Langa;
378 implemented by Guido van Rossum.
Yury Selivanov5df36af2015-08-04 12:46:57 -0400379
380
Victor Stinner6036e442015-03-08 01:58:04 +0100381PEP 471 - os.scandir() function -- a better and faster directory iterator
382-------------------------------------------------------------------------
383
Victor Stinner37f20342015-03-10 13:29:41 +0100384:pep:`471` adds a new directory iteration function, :func:`os.scandir`,
385to the standard library. Additionally, :func:`os.walk` is now
386implemented using :func:`os.scandir`, which speeds it up by 3-5 times
387on POSIX systems and by 7-20 times on Windows systems.
388
Victor Stinner6036e442015-03-08 01:58:04 +0100389.. seealso::
390
Yury Selivanovdfcfe132015-09-08 15:33:15 -0400391 :pep:`471` -- os.scandir() function -- a better and faster directory iterator
392 PEP written and implemented by Ben Hoyt with the help of Victor Stinner.
Victor Stinner6036e442015-03-08 01:58:04 +0100393
394
Charles-François Natali6e6c59b2015-02-07 13:27:50 +0000395PEP 475: Retry system calls failing with EINTR
396----------------------------------------------
397
Victor Stinnerf70e1ca2015-03-30 21:16:11 +0200398:pep:`475` adds support for automatic retry of system calls failing with
399:py:data:`~errno.EINTR`: this means that user code doesn't have to deal with
400EINTR or :exc:`InterruptedError` manually, and should make it more robust
401against asynchronous signal reception.
Charles-François Natali6e6c59b2015-02-07 13:27:50 +0000402
Victor Stinner6752d652015-07-29 01:11:10 +0200403Examples of functions which are now retried when interrupted by a signal
404instead of raising :exc:`InterruptedError` if the Python signal handler does
405not raise an exception:
406
407* :func:`open`, :func:`os.open`, :func:`io.open`
408* functions of the :mod:`faulthandler` module
409* :mod:`os` functions:
410
411 - :func:`os.fchdir`
412 - :func:`os.fchmod`
413 - :func:`os.fchown`
414 - :func:`os.fdatasync`
415 - :func:`os.fstat`
416 - :func:`os.fstatvfs`
417 - :func:`os.fsync`
418 - :func:`os.ftruncate`
419 - :func:`os.mkfifo`
420 - :func:`os.mknod`
421 - :func:`os.posix_fadvise`
422 - :func:`os.posix_fallocate`
423 - :func:`os.pread`
424 - :func:`os.pwrite`
425 - :func:`os.read`
426 - :func:`os.readv`
427 - :func:`os.sendfile`
428 - :func:`os.wait3`
429 - :func:`os.wait4`
430 - :func:`os.wait`
431 - :func:`os.waitid`
432 - :func:`os.waitpid`
433 - :func:`os.write`
434 - :func:`os.writev`
435 - special cases: :func:`os.close` and :func:`os.dup2` now ignore
436 :py:data:`~errno.EINTR` error, the syscall is not retried (see the PEP
437 for the rationale)
438
439* :mod:`select` functions:
440
441 - :func:`select.devpoll.poll`
442 - :func:`select.epoll.poll`
443 - :func:`select.kqueue.control`
444 - :func:`select.poll.poll`
445 - :func:`select.select`
446
447* :func:`socket.socket` methods:
448
449 - :meth:`~socket.socket.accept`
450 - :meth:`~socket.socket.connect` (except for non-blocking sockets)
451 - :meth:`~socket.socket.recv`
452 - :meth:`~socket.socket.recvfrom`
453 - :meth:`~socket.socket.recvmsg`
454 - :meth:`~socket.socket.send`
455 - :meth:`~socket.socket.sendall`
456 - :meth:`~socket.socket.sendmsg`
457 - :meth:`~socket.socket.sendto`
458
459* :func:`signal.sigtimedwait`, :func:`signal.sigwaitinfo`
460* :func:`time.sleep`
461
Charles-François Natali6e6c59b2015-02-07 13:27:50 +0000462.. seealso::
463
464 :pep:`475` -- Retry system calls failing with EINTR
Yury Selivanovdfcfe132015-09-08 15:33:15 -0400465 PEP and implementation written by Charles-François Natali and
466 Victor Stinner, with the help of Antoine Pitrou (the french connection).
Victor Stinner01adf062014-03-18 00:53:32 +0100467
468
Yury Selivanov8d006e72015-05-22 11:30:45 -0400469PEP 479: Change StopIteration handling inside generators
470--------------------------------------------------------
471
472:pep:`479` changes the behavior of generators: when a :exc:`StopIteration`
473exception is raised inside a generator, it is replaced with a
474:exc:`RuntimeError`. To enable the feature a ``__future__`` import should
475be used::
476
477 from __future__ import generator_stop
478
479Without a ``__future__`` import, a :exc:`PendingDeprecationWarning` will be
480raised.
481
Yury Selivanov8d006e72015-05-22 11:30:45 -0400482.. seealso::
483
484 :pep:`479` -- Change StopIteration handling inside generators
Yury Selivanovdfcfe132015-09-08 15:33:15 -0400485 PEP written by Chris Angelico and Guido van Rossum. Implemented by
486 Chris Angelico, Yury Selivanov and Nick Coghlan.
Yury Selivanov8d006e72015-05-22 11:30:45 -0400487
488
Steve Dower76998fe2015-02-26 14:25:33 -0800489PEP 486: Make the Python Launcher aware of virtual environments
490---------------------------------------------------------------
491
492:pep:`486` makes the Windows launcher (see :pep:`397`) aware of an active
493virtual environment. When the default interpreter would be used and the
494``VIRTUAL_ENV`` environment variable is set, the interpreter in the virtual
495environment will be used.
496
497.. seealso::
498
499 :pep:`486` -- Make the Python Launcher aware of virtual environments
Yury Selivanovdfcfe132015-09-08 15:33:15 -0400500 PEP written and implemented by Paul Moore.
Steve Dower76998fe2015-02-26 14:25:33 -0800501
Brett Cannonf299abd2015-04-13 14:21:02 -0400502
503PEP 488: Elimination of PYO files
504---------------------------------
505
506:pep:`488` does away with the concept of ``.pyo`` files. This means that
Benjamin Petersone3283232015-05-26 21:40:28 -0500507``.pyc`` files represent both unoptimized and optimized bytecode. To prevent the
508need to constantly regenerate bytecode files, ``.pyc`` files now have an
509optional ``opt-`` tag in their name when the bytecode is optimized. This has the
510side-effect of no more bytecode file name clashes when running under either
511``-O`` or ``-OO``. Consequently, bytecode files generated from ``-O``, and
512``-OO`` may now exist simultaneously. :func:`importlib.util.cache_from_source`
513has an updated API to help with this change.
Brett Cannonf299abd2015-04-13 14:21:02 -0400514
515.. seealso::
516
517 :pep:`488` -- Elimination of PYO files
Yury Selivanovdfcfe132015-09-08 15:33:15 -0400518 PEP written and implemented by Brett Cannon.
Brett Cannonf299abd2015-04-13 14:21:02 -0400519
520
Nick Coghland5cacbb2015-05-23 22:24:10 +1000521PEP 489: Multi-phase extension module initialization
522----------------------------------------------------
523
524:pep:`489` updates extension module initialization to take advantage of the
525two step module loading mechanism introduced by :pep:`451` in Python 3.4.
526
527This change brings the import semantics of extension modules that opt-in to
528using the new mechanism much closer to those of Python source and bytecode
Nick Coghlan2ab5b092015-07-03 19:49:15 +1000529modules, including the ability to use any valid identifier as a module name,
Nick Coghland5cacbb2015-05-23 22:24:10 +1000530rather than being restricted to ASCII.
531
532.. seealso::
533
Yury Selivanovdfcfe132015-09-08 15:33:15 -0400534 :pep:`489` -- Multi-phase extension module initialization
535 PEP written by Petr Viktorin, Stefan Behnel, and Nick Coghlan;
536 implementation by Petr Viktorin.
537
Nick Coghland5cacbb2015-05-23 22:24:10 +1000538
Tal Einatd5519ed2015-05-31 22:05:00 +0300539PEP 485: A function for testing approximate equality
540----------------------------------------------------
541
542:pep:`485` adds the :func:`math.isclose` and :func:`cmath.isclose`
543functions which tell whether two values are approximately equal or
544"close" to each other. Whether or not two values are considered
545close is determined according to given absolute and relative tolerances.
546
547.. seealso::
548
549 :pep:`485` -- A function for testing approximate equality
Yury Selivanovdfcfe132015-09-08 15:33:15 -0400550 PEP written by Christopher Barker; implemented by Chris Barker and
551 Tal Einat.
552
Tal Einatd5519ed2015-05-31 22:05:00 +0300553
Victor Stinner01adf062014-03-18 00:53:32 +0100554Other Language Changes
555======================
556
557Some smaller changes made to the core Python language are:
558
Serhiy Storchaka07985ef2015-01-25 22:56:57 +0200559* Added the ``'namereplace'`` error handlers. The ``'backslashreplace'``
560 error handlers now works with decoding and translating.
561 (Contributed by Serhiy Storchaka in :issue:`19676` and :issue:`22286`.)
Victor Stinner01adf062014-03-18 00:53:32 +0100562
Serhiy Storchaka1dd49822015-03-20 16:54:57 +0200563* The :option:`-b` option now affects comparisons of :class:`bytes` with
564 :class:`int`. (Contributed by Serhiy Storchaka in :issue:`23681`)
Victor Stinner01adf062014-03-18 00:53:32 +0100565
Serhiy Storchakaad8a1c32015-05-12 23:16:55 +0300566* New Kazakh :ref:`codec <standard-encodings>` ``kz1048``. (Contributed by
567 Serhiy Storchaka in :issue:`22682`.)
568
Raymond Hettingereac503a2015-05-13 01:09:59 -0700569* Property docstrings are now writable. This is especially useful for
570 :func:`collections.namedtuple` docstrings.
571 (Contributed by Berker Peksag in :issue:`24064`.)
572
Serhiy Storchakaf0eeedf2015-05-12 23:24:19 +0300573* New Tajik :ref:`codec <standard-encodings>` ``koi8_t``. (Contributed by
574 Serhiy Storchaka in :issue:`22681`.)
575
Victor Stinner01adf062014-03-18 00:53:32 +0100576
577New Modules
578===========
579
Brett Cannoncc4dfc12015-03-13 10:40:49 -0400580.. _whatsnew-zipapp:
Victor Stinner01adf062014-03-18 00:53:32 +0100581
Brett Cannoncc4dfc12015-03-13 10:40:49 -0400582zipapp
583------
584
585The new :mod:`zipapp` module (specified in :pep:`441`) provides an API and
586command line tool for creating executable Python Zip Applications, which
587were introduced in Python 2.6 in :issue:`1739468` but which were not well
588publicised, either at the time or since.
589
590With the new module, bundling your application is as simple as putting all
591the files, including a ``__main__.py`` file, into a directory ``myapp``
592and running::
593
594 $ python -m zipapp myapp
595 $ python myapp.pyz
Victor Stinner01adf062014-03-18 00:53:32 +0100596
597
598Improved Modules
599================
600
Berker Peksag8089cd62015-02-14 01:39:17 +0200601argparse
602--------
603
604* :class:`~argparse.ArgumentParser` now allows to disable
605 :ref:`abbreviated usage <prefix-matching>` of long options by setting
606 :ref:`allow_abbrev` to ``False``.
607 (Contributed by Jonathan Paugh, Steven Bethard, paul j3 and Daniel Eriksson.)
608
Berker Peksagbf5e9602015-02-06 10:21:37 +0200609cgi
610---
611
Berker Peksagbd09d7b2015-02-11 15:32:34 +0200612* :class:`~cgi.FieldStorage` now supports the context management protocol.
Berker Peksagbf5e9602015-02-06 10:21:37 +0200613 (Contributed by Berker Peksag in :issue:`20289`.)
614
Tal Einatd5519ed2015-05-31 22:05:00 +0300615cmath
616-----
617
618* :func:`cmath.isclose` function added.
619 (Contributed by Chris Barker and Tal Einat in :issue:`24270`.)
620
621
R David Murrayc31e6222014-09-29 11:25:00 -0400622code
623----
624
625* The :func:`code.InteractiveInterpreter.showtraceback` method now prints
Serhiy Storchakac1ded292014-11-02 19:22:02 +0200626 the full chained traceback, just like the interactive interpreter.
Berker Peksag088ca8b2015-02-06 10:17:49 +0200627 (Contributed by Claudiu Popa in :issue:`17442`.)
R David Murrayc31e6222014-09-29 11:25:00 -0400628
Raymond Hettingereac503a2015-05-13 01:09:59 -0700629collections
630-----------
631
632* You can now update docstrings produced by :func:`collections.namedtuple`::
633
634 Point = namedtuple('Point', ['x', 'y'])
635 Point.__doc__ = 'ordered pair'
636 Point.x.__doc__ = 'abscissa'
637 Point.y.__doc__ = 'ordinate'
638
639 (Contributed by Berker Peksag in :issue:`24064`.)
640
Brett Cannonf1a8df02014-09-12 10:39:48 -0400641compileall
642----------
643
644* :func:`compileall.compile_dir` and :mod:`compileall`'s command-line interface
645 can now do parallel bytecode compilation.
Serhiy Storchakac1ded292014-11-02 19:22:02 +0200646 (Contributed by Claudiu Popa in :issue:`16104`.)
Brett Cannonf1a8df02014-09-12 10:39:48 -0400647
Berker Peksagbb44fe02014-11-28 23:28:06 +0200648contextlib
649----------
650
651* The new :func:`contextlib.redirect_stderr` context manager(similar to
652 :func:`contextlib.redirect_stdout`) makes it easier for utility scripts to
653 handle inflexible APIs that write their output to :data:`sys.stderr` and
654 don't provide any options to redirect it.
655 (Contributed by Berker Peksag in :issue:`22389`.)
656
Steve Dowerd2bc3892015-04-15 18:06:05 -0400657curses
658------
659* The new :func:`curses.update_lines_cols` function updates the variables
660 :envvar:`curses.LINES` and :envvar:`curses.COLS`.
661
Berker Peksag102029d2015-03-15 01:18:47 +0200662difflib
663-------
664
665* The charset of the HTML document generated by :meth:`difflib.HtmlDiff.make_file`
666 can now be customized by using *charset* keyword-only parameter. The default
667 charset of HTML document changed from ``'ISO-8859-1'`` to ``'utf-8'``.
668 (Contributed by Berker Peksag in :issue:`2052`.)
669
Greg Ward4d9d2562015-04-20 20:21:21 -0400670* It's now possible to compare lists of byte strings with
671 :func:`difflib.diff_bytes` (fixes a regression from Python 2).
672
Berker Peksag618e3152015-01-27 02:59:09 +0200673distutils
674---------
675
676* The ``build`` and ``build_ext`` commands now accept a ``-j``
677 option to enable parallel building of extension modules.
678 (Contributed by Antoine Pitrou in :issue:`5309`.)
679
Serhiy Storchakab9cec6a2015-05-16 22:13:27 +0300680* Added support for the LZMA compression.
681 (Contributed by Serhiy Storchaka in :issue:`16314`.)
682
Antoine Pitroub9d9ce72014-05-15 22:47:33 +0200683doctest
684-------
Giampaolo Rodola'e09fb712014-04-04 15:34:17 +0200685
Antoine Pitroub9d9ce72014-05-15 22:47:33 +0200686* :func:`doctest.DocTestSuite` returns an empty :class:`unittest.TestSuite` if
Serhiy Storchakac1ded292014-11-02 19:22:02 +0200687 *module* contains no docstrings instead of raising :exc:`ValueError`.
688 (Contributed by Glenn Jones in :issue:`15916`.)
Antoine Pitroub9d9ce72014-05-15 22:47:33 +0200689
R David Murrayb744f3a2015-05-16 15:41:07 -0400690email
691-----
692
R David Murrayfdb23c22015-05-17 14:24:33 -0400693* A new policy option :attr:`~email.policy.Policy.mangle_from_` controls
694 whether or not lines that start with "From " in email bodies are prefixed with
695 a '>' character by generators. The default is ``True`` for
696 :attr:`~email.policy.compat32` and ``False`` for all other policies.
697 (Contributed by Milan Oberkirch in :issue:`20098`.)
698
R David Murrayb744f3a2015-05-16 15:41:07 -0400699* A new method :meth:`~email.message.Message.get_content_disposition` provides
700 easy access to a canonical value for the :mailheader:`Content-Disposition`
701 header (``None`` if there is no such header). (Contributed by Abhilash Raj
702 in :issue:`21083`.)
703
R David Murray224ef3e2015-05-17 11:29:21 -0400704* A new policy option :attr:`~email.policy.EmailPolicy.utf8` can be set
705 ``True`` to encode email headers using the utf8 charset instead of using
706 encoded words. This allows ``Messages`` to be formatted according to
707 :rfc:`6532` and used with an SMTP server that supports the :rfc:`6531`
708 ``SMTPUTF8`` extension. (Contributed by R. David Murray in :issue:`24211`.)
709
Serhiy Storchakac2edcdd2014-09-11 12:17:37 +0300710glob
711----
712
713* :func:`~glob.iglob` and :func:`~glob.glob` now support recursive search in
714 subdirectories using the "``**``" pattern.
715 (Contributed by Serhiy Storchaka in :issue:`13968`.)
716
Guido van Rossum7ca13532015-05-23 15:27:51 -0700717idlelib and IDLE
Terry Jan Reedy44825cf2015-05-23 18:19:42 -0400718----------------
719
720Since idlelib implements the IDLE shell and editor and is not intended for
721import by other programs, it gets improvements with every release. See
722:file:`Lib/idlelib/NEWS.txt` for a cumulative list of changes since 3.4.0,
723as well as changes made in future 3.5.x releases. This file is also available
724from the IDLE Help -> About Idle dialog.
725
Serhiy Storchaka38684c32014-09-09 19:07:49 +0300726imaplib
727-------
728
729* :class:`IMAP4` now supports the context management protocol. When used in a
730 :keyword:`with` statement, the IMAP4 ``LOGOUT`` command will be called
731 automatically at the end of the block. (Contributed by Tarek Ziadé and
Serhiy Storchakac1ded292014-11-02 19:22:02 +0200732 Serhiy Storchaka in :issue:`4972`.)
Serhiy Storchaka38684c32014-09-09 19:07:49 +0300733
R David Murraya6429db2015-05-10 19:17:23 -0400734* :mod:`imaplib` now supports :rfc:`5161`: the :meth:`~imaplib.IMAP4.enable`
735 extension), and :rfc:`6855`: utf-8 support (internationalized email, via the
736 ``UTF8=ACCEPT`` argument to :meth:`~imaplib.IMAP4.enable`). A new attribute,
737 :attr:`~imaplib.IMAP4.utf8_enabled`, tracks whether or not :rfc:`6855`
738 support is enabled. Milan Oberkirch, R. David Murray, and Maciej Szulik in
739 :issue:`21800`.)
740
741* :mod:`imaplib` now automatically encodes non-ASCII string usernames and
742 passwords using ``UTF8``, as recommended by the RFCs. (Contributed by Milan
743 Oberkirch in :issue:`21800`.)
744
R David Murray2f608202014-06-26 12:27:57 -0400745imghdr
746------
747
748* :func:`~imghdr.what` now recognizes the `OpenEXR <http://www.openexr.com>`_
Berker Peksag088ca8b2015-02-06 10:17:49 +0200749 format. (Contributed by Martin Vignali and Claudiu Popa in :issue:`20295`.)
R David Murray2f608202014-06-26 12:27:57 -0400750
Antoine Pitroub9d9ce72014-05-15 22:47:33 +0200751importlib
752---------
753
754* :class:`importlib.util.LazyLoader` allows for the lazy loading of modules in
Serhiy Storchakac1ded292014-11-02 19:22:02 +0200755 applications where startup time is paramount.
756 (Contributed by Brett Cannon in :issue:`17621`.)
Antoine Pitroub9d9ce72014-05-15 22:47:33 +0200757
758* :func:`importlib.abc.InspectLoader.source_to_code` is now a
759 static method to make it easier to work with source code in a string.
760 With a module object that you want to initialize you can then use
761 ``exec(code, module.__dict__)`` to execute the code in the module.
762
Brett Cannon2a17bde2014-05-30 14:55:29 -0400763* :func:`importlib.util.module_from_spec` is now the preferred way to create a
764 new module. Compared to :class:`types.ModuleType`, this new function will set
765 the various import-controlled attributes based on the passed-in spec object.
766
Antoine Pitroub9d9ce72014-05-15 22:47:33 +0200767inspect
768-------
Victor Stinner01adf062014-03-18 00:53:32 +0100769
Yury Selivanova5d63dd2014-03-27 11:31:43 -0400770* :class:`inspect.Signature` and :class:`inspect.Parameter` are now
Serhiy Storchakac1ded292014-11-02 19:22:02 +0200771 picklable and hashable. (Contributed by Yury Selivanov in :issue:`20726`
772 and :issue:`20334`.)
Yury Selivanova5d63dd2014-03-27 11:31:43 -0400773
Yury Selivanovb907a512015-05-16 13:45:09 -0400774* New method :meth:`inspect.BoundArguments.apply_defaults`. (Contributed
775 by Yury Selivanov in :issue:`24190`.)
776
Yury Selivanovda396452014-03-27 12:09:24 -0400777* New class method :meth:`inspect.Signature.from_callable`, which makes
Serhiy Storchakac1ded292014-11-02 19:22:02 +0200778 subclassing of :class:`~inspect.Signature` easier. (Contributed
779 by Yury Selivanov and Eric Snow in :issue:`17373`.)
Yury Selivanovda396452014-03-27 12:09:24 -0400780
Yury Selivanovbcd4fc12015-05-20 14:30:08 -0400781* New argument ``follow_wrapped`` for :func:`inspect.signature`.
782 (Contributed by Yury Selivanov in :issue:`20691`.)
783
Yury Selivanovfdbeb2b2015-07-03 13:11:35 -0400784* New :func:`~inspect.iscoroutine`, :func:`~inspect.iscoroutinefunction`
785 and :func:`~inspect.isawaitable` functions. (Contributed by
786 Yury Selivanov in :issue:`24017`.)
Yury Selivanovf3e40fa2015-05-21 11:50:30 -0400787
Yury Selivanov5376ba92015-06-22 12:19:30 -0400788* New :func:`~inspect.getcoroutinelocals` and :func:`~inspect.getcoroutinestate`
789 functions. (Contributed by Yury Selivanov in :issue:`24400`.)
790
Antoine Pitrou0dfce562014-05-15 22:55:40 +0200791ipaddress
792---------
793
794* :class:`ipaddress.IPv4Network` and :class:`ipaddress.IPv6Network` now
795 accept an ``(address, netmask)`` tuple argument, so as to easily construct
Serhiy Storchakac1ded292014-11-02 19:22:02 +0200796 network objects from existing addresses. (Contributed by Peter Moody
797 and Antoine Pitrou in :issue:`16531`.)
Antoine Pitrou0dfce562014-05-15 22:55:40 +0200798
Berker Peksag39e4c4d2014-11-10 09:56:54 +0200799json
800----
801
802* The output of :mod:`json.tool` command line interface is now in the same
803 order as the input. Use the :option:`--sort-keys` option to sort the output
804 of dictionaries alphabetically by key. (Contributed by Berker Peksag in
805 :issue:`21650`.)
806
Serhiy Storchaka47efb4a2015-01-26 13:16:30 +0200807* JSON decoder now raises :exc:`json.JSONDecodeError` instead of
808 :exc:`ValueError`. (Contributed by Serhiy Storchaka in :issue:`19361`.)
809
Tal Einatf67b0a32015-05-31 22:18:31 +0300810math
811----
812
813* :data:`math.inf` and :data:`math.nan` constants added. (Contributed by Mark
814 Dickinson in :issue:`23185`.)
815* :func:`math.isclose` function added.
816 (Contributed by Chris Barker and Tal Einat in :issue:`24270`.)
817
Zachary Ware63f277b2014-06-19 09:46:37 -0500818os
819--
820
Victor Stinner37f20342015-03-10 13:29:41 +0100821* New :func:`os.scandir` function that exposes file information from
822 the operating system when listing a directory. :func:`os.scandir`
823 returns an iterator of :class:`os.DirEntry` objects corresponding to
824 the entries in the directory given by *path*. (Contributed by Ben
825 Hoyt with the help of Victor Stinner in :issue:`22524`.)
Victor Stinner6036e442015-03-08 01:58:04 +0100826
Victor Stinnere1d24f72014-07-24 12:44:07 +0200827* :class:`os.stat_result` now has a :attr:`~os.stat_result.st_file_attributes`
Serhiy Storchakac1ded292014-11-02 19:22:02 +0200828 attribute on Windows. (Contributed by Ben Hoyt in :issue:`21719`.)
Zachary Ware63f277b2014-06-19 09:46:37 -0500829
Victor Stinnerace88482015-07-29 02:28:32 +0200830* :func:`os.urandom`: On Linux 3.17 and newer, the ``getrandom()`` syscall is
831 now used when available. On OpenBSD 5.6 and newer, the C ``getentropy()``
832 function is now used. These functions avoid the usage of an internal file
833 descriptor.
834
Serhiy Storchaka38220932015-03-31 15:31:53 +0300835os.path
836-------
837
838* New :func:`~os.path.commonpath` function that extracts common path prefix.
839 Unlike the :func:`~os.path.commonprefix` function, it always returns a valid
Larry Hastingsd5b129c2015-08-24 12:49:22 -0700840 path. (Contributed by Rafik Draoui and Serhiy Storchaka in :issue:`10395`.)
Serhiy Storchaka38220932015-03-31 15:31:53 +0300841
Serhiy Storchaka58e41342015-03-31 14:07:24 +0300842pickle
843------
844
845* Serializing more "lookupable" objects (such as unbound methods or nested
846 classes) now are supported with pickle protocols < 4.
847 (Contributed by Serhiy Storchaka in :issue:`23611`.)
848
R David Murrayb8cd3e42015-05-16 15:05:53 -0400849poplib
850------
851
852* A new command :meth:`~poplib.POP3.utf8` enables :rfc:`6856`
853 (internationalized email) support if the POP server supports it. (Contributed
854 by Milan OberKirch in :issue:`21804`.)
855
Serhiy Storchaka9baa5b22014-09-29 22:49:23 +0300856re
857--
858
859* Number of capturing groups in regular expression is no longer limited by 100.
860 (Contributed by Serhiy Storchaka in :issue:`22437`.)
861
Serhiy Storchaka7438e4b2014-10-10 11:06:31 +0300862* Now unmatched groups are replaced with empty strings in :func:`re.sub`
863 and :func:`re.subn`. (Contributed by Serhiy Storchaka in :issue:`1519638`.)
864
R David Murray6ffface2014-06-11 14:40:13 -0400865shutil
866------
867
868* :func:`~shutil.move` now accepts a *copy_function* argument, allowing,
869 for example, :func:`~shutil.copy` to be used instead of the default
870 :func:`~shutil.copy2` if there is a need to ignore metadata. (Contributed by
871 Claudiu Popa in :issue:`19840`.)
872
Antoine Pitroub9d9ce72014-05-15 22:47:33 +0200873signal
874------
Brett Cannona04dbe42014-04-04 13:53:38 -0400875
Victor Stinnerbbe38032015-04-01 16:32:32 +0200876* On Windows, :func:`signal.set_wakeup_fd` now also supports socket handles.
877 (Contributed by Victor Stinner in :issue:`22018`.)
878
Antoine Pitroub9d9ce72014-05-15 22:47:33 +0200879* Different constants of :mod:`signal` module are now enumeration values using
880 the :mod:`enum` module. This allows meaningful names to be printed during
Serhiy Storchakac1ded292014-11-02 19:22:02 +0200881 debugging, instead of integer “magic numbers”. (Contributed by Giampaolo
882 Rodola' in :issue:`21076`.)
R David Murray1976d9b2014-04-14 20:28:36 -0400883
R David Murray554bcbf2014-06-11 11:18:08 -0400884smtpd
885-----
886
887* Both :class:`~smtpd.SMTPServer` and :class:`smtpd.SMTPChannel` now accept a
888 *decode_data* keyword to determine if the DATA portion of the SMTP
889 transaction is decoded using the ``utf-8`` codec or is instead provided to
890 :meth:`~smtpd.SMTPServer.process_message` as a byte string. The default
891 is ``True`` for backward compatibility reasons, but will change to ``False``
R David Murraya33df312015-05-11 12:11:40 -0400892 in Python 3.6. If *decode_data* is set to ``False``, the
893 :meth:`~smtpd.SMTPServer.process_message` method must be prepared to accept
894 keyword arguments. (Contributed by Maciej Szulik in :issue:`19662`.)
895
896* :class:`~smtpd.SMTPServer` now advertises the ``8BITMIME`` extension
897 (:rfc:`6152`) if if *decode_data* has been set ``True``. If the client
898 specifies ``BODY=8BITMIME`` on the ``MAIL`` command, it is passed to
899 :meth:`~smtpd.SMTPServer.process_message` via the ``mail_options`` keyword.
900 (Contributed by Milan Oberkirch and R. David Murray in :issue:`21795`.)
901
902* :class:`~smtpd.SMTPServer` now supports the ``SMTPUTF8`` extension
903 (:rfc:`6531`: Internationalized Email). If the client specified ``SMTPUTF8
904 BODY=8BITMIME`` on the ``MAIL`` command, they are passed to
905 :meth:`~smtpd.SMTPServer.process_message` via the ``mail_options`` keyword.
906 It is the responsibility of the :meth:`~smtpd.SMTPServer.process_message`
907 method to correctly handle the ``SMTPUTF8`` data. (Contributed by Milan
908 Oberkirch in :issue:`21725`.)
R David Murray554bcbf2014-06-11 11:18:08 -0400909
R David Murray6fe56a32014-06-11 13:48:58 -0400910* It is now possible to provide, directly or via name resolution, IPv6
911 addresses in the :class:`~smtpd.SMTPServer` constructor, and have it
912 successfully connect. (Contributed by Milan Oberkirch in :issue:`14758`.)
913
R David Murray76e13c12014-07-03 14:47:46 -0400914smtplib
915-------
916
917* A new :meth:`~smtplib.SMTP.auth` method provides a convenient way to
Serhiy Storchakac1ded292014-11-02 19:22:02 +0200918 implement custom authentication mechanisms.
919 (Contributed by Milan Oberkirch in :issue:`15014`.)
R David Murray76e13c12014-07-03 14:47:46 -0400920
R David Murray0c49b892015-04-16 17:14:42 -0400921* Additional debuglevel (2) shows timestamps for debug messages in
922 :class:`smtplib.SMTP`. (Contributed by Gavin Chappell and Maciej Szulik in
923 :issue:`16914`.)
924
R David Murray83084442015-05-17 19:27:22 -0400925* :mod:`smtplib` now supports :rfc:`6531` (SMTPUTF8) in both the
926 :meth:`~smtplib.SMTP.sendmail` and :meth:`~smtplib.SMTP.send_message`
927 commands. (Contributed by Milan Oberkirch and R. David Murray in
928 :issue:`22027`.)
R David Murraycee7cf62015-05-16 13:58:14 -0400929
R David Murray4487dd02014-10-09 16:59:30 -0400930sndhdr
931------
932
933* :func:`~sndhdr.what` and :func:`~sndhdr.whathdr` now return
Serhiy Storchakac1ded292014-11-02 19:22:02 +0200934 :func:`~collections.namedtuple`.
935 (Contributed by Claudiu Popa in :issue:`18615`.)
R David Murray4487dd02014-10-09 16:59:30 -0400936
Victor Stinner287452e2015-07-29 01:39:13 +0200937ssl
938---
939
Yury Selivanov7d6adab2015-08-05 19:01:51 -0400940* The :meth:`~ssl.SSLSocket.do_handshake`, :meth:`~ssl.SSLSocket.read`,
941 :meth:`~ssl.SSLSocket.shutdown`, and :meth:`~ssl.SSLSocket.write` methods of
942 :class:`ssl.SSLSocket` don't reset the socket timeout anymore each time bytes
943 are received or sent. The socket timeout is now the maximum total duration of
944 the method.
945
946* Memory BIO Support: new classes :class:`~ssl.SSLObject`,
947 :class:`~ssl.MemoryBIO`, and new
948 :meth:`SSLContext.wrap_bio <ssl.SSLContext.wrap_bio>` method.
949 (Contributed by Geert Jansen in :issue:`21965`.)
Victor Stinner287452e2015-07-29 01:39:13 +0200950
Giampaolo Rodola'915d1412014-06-11 03:54:30 +0200951socket
952------
953
954* New :meth:`socket.socket.sendfile` method allows to send a file over a socket
955 by using high-performance :func:`os.sendfile` function on UNIX resulting in
956 uploads being from 2x to 3x faster than when using plain
957 :meth:`socket.socket.send`.
Serhiy Storchakac1ded292014-11-02 19:22:02 +0200958 (Contributed by Giampaolo Rodola' in :issue:`17552`.)
Giampaolo Rodola'915d1412014-06-11 03:54:30 +0200959
Victor Stinner98810132015-07-29 01:41:25 +0200960* The :meth:`socket.socket.sendall` method don't reset the socket timeout
961 anymore each time bytes are received or sent. The socket timeout is now the
962 maximum total duration to send all data.
963
Gregory P. Smith6e730002015-04-14 16:14:25 -0700964subprocess
965----------
966
967* The new :func:`subprocess.run` function runs subprocesses and returns a
968 :class:`subprocess.CompletedProcess` object. It Provides a more consistent
969 API than :func:`~subprocess.call`, :func:`~subprocess.check_call` and
970 :func:`~subprocess.check_output`.
971
Yury Selivanov4640b302015-05-31 17:21:38 -0400972sys
973---
974
975* New :func:`~sys.set_coroutine_wrapper` and :func:`~sys.get_coroutine_wrapper`
976 functions. (Contributed by Yury Selivanov in :issue:`24017`.)
977
Eric V. Smith7a803892015-04-15 10:27:58 -0400978sysconfig
979---------
980
981* The user scripts directory on Windows is now versioned.
982 (Contributed by Paul Moore in :issue:`23437`.)
983
984tarfile
985-------
986
987* The :func:`tarfile.open` function now supports ``'x'`` (exclusive creation)
988 mode. (Contributed by Berker Peksag in :issue:`21717`.)
989
990* The :meth:`~tarfile.TarFile.extractall` and :meth:`~tarfile.TarFile.extract`
991 methods now take a keyword parameter *numeric_only*. If set to ``True``,
992 the extracted files and directories will be owned by the numeric uid and gid
993 from the tarfile. If set to ``False`` (the default, and the behavior in
994 versions prior to 3.5), they will be owned bythe named user and group in the
995 tarfile. (Contributed by Michael Vogt and Eric Smith in :issue:`23193`.)
996
Victor Stinnerae586492014-09-02 23:18:25 +0200997time
998----
999
Berker Peksag882c95c2014-10-09 11:46:56 +03001000* The :func:`time.monotonic` function is now always available. (Contributed by
1001 Victor Stinner in :issue:`22043`.)
Victor Stinnerae586492014-09-02 23:18:25 +02001002
Zachary Ware7dc9dea2015-05-22 11:36:53 -05001003tkinter
1004-------
1005
Nick Coghland5cacbb2015-05-23 22:24:10 +10001006* The :mod:`tkinter._fix` module used for setting up the Tcl/Tk environment
Berker Peksag1a90b172015-05-24 00:26:05 +03001007 on Windows has been replaced by a private function in the :mod:`_tkinter`
Zachary Ware7dc9dea2015-05-22 11:36:53 -05001008 module which makes no permanent changes to environment variables.
1009 (Contributed by Zachary Ware in :issue:`20035`.)
1010
Yury Selivanovf3e40fa2015-05-21 11:50:30 -04001011types
1012-----
1013
1014* New :func:`~types.coroutine` function. (Contributed by Yury Selivanov
1015 in :issue:`24017`.)
1016
Yury Selivanov5376ba92015-06-22 12:19:30 -04001017* New :class:`~types.CoroutineType`. (Contributed by Yury Selivanov
1018 in :issue:`24400`.)
1019
Berker Peksagbd09d7b2015-02-11 15:32:34 +02001020urllib
1021------
Nick Coghlanc216c482014-11-12 23:33:50 +10001022
R David Murray4c7f9952015-04-16 16:36:18 -04001023* A new :class:`~urllib.request.HTTPPasswordMgrWithPriorAuth` allows HTTP Basic
1024 Authentication credentials to be managed so as to eliminate unnecessary
1025 ``401`` response handling, or to unconditionally send credentials
1026 on the first request in order to communicate with servers that return a
1027 ``404`` response instead of a ``401`` if the ``Authorization`` header is not
1028 sent. (Contributed by Matej Cepl in :issue:`19494` and Akshit Khurana in
1029 :issue:`7159`.)
Nick Coghlanc216c482014-11-12 23:33:50 +10001030
R David Murrayc17686f2015-05-17 20:44:50 -04001031* A new :func:`~urllib.parse.urlencode` parameter *quote_via* provides a way to
1032 control the encoding of query parts if needed. (Contributed by Samwyse and
1033 Arnon Yaari in :issue:`13866`.)
1034
Benjamin Peterson48013832015-06-27 15:45:56 -05001035unicodedata
1036-----------
1037
1038* The :mod:`unicodedata` module now uses data from `Unicode 8.0.0
Nick Coghlan2ab5b092015-07-03 19:49:15 +10001039 <http://unicode.org/versions/Unicode8.0.0/>`_.
Benjamin Peterson48013832015-06-27 15:45:56 -05001040
1041
Berker Peksag3e887222014-07-02 08:37:22 +03001042wsgiref
1043-------
1044
1045* *headers* parameter of :class:`wsgiref.headers.Headers` is now optional.
1046 (Contributed by Pablo Torres Navarrete and SilentGhost in :issue:`5800`.)
1047
Antoine Pitroub9d9ce72014-05-15 22:47:33 +02001048xmlrpc
1049------
1050
Serhiy Storchakac1ded292014-11-02 19:22:02 +02001051* :class:`xmlrpc.client.ServerProxy` is now a :term:`context manager`.
1052 (Contributed by Claudiu Popa in :issue:`20627`.)
Brett Cannon6eaac132014-05-09 12:28:22 -04001053
Serhiy Storchaka61de0872015-04-02 21:00:13 +03001054xml.sax
1055-------
1056
1057* SAX parsers now support a character stream of
1058 :class:`~xml.sax.xmlreader.InputSource` object.
1059 (Contributed by Serhiy Storchaka in :issue:`2175`.)
1060
Victor Stinner95bb7142015-03-12 15:32:03 +01001061faulthandler
1062------------
1063
1064* :func:`~faulthandler.enable`, :func:`~faulthandler.register`,
1065 :func:`~faulthandler.dump_traceback` and
1066 :func:`~faulthandler.dump_traceback_later` functions now accept file
1067 descriptors. (Contributed by Wei Wu in :issue:`23566`.)
1068
Serhiy Storchaka77d89972015-03-23 01:09:35 +02001069zipfile
1070-------
1071
1072* Added support for writing ZIP files to unseekable streams.
1073 (Contributed by Serhiy Storchaka in :issue:`23252`.)
1074
Serhiy Storchaka764fc9b2015-03-25 10:09:41 +02001075* The :func:`zipfile.ZipFile.open` function now supports ``'x'`` (exclusive
1076 creation) mode. (Contributed by Serhiy Storchaka in :issue:`21717`.)
1077
Victor Stinner01adf062014-03-18 00:53:32 +01001078
1079Optimizations
1080=============
1081
Antoine Pitroub9d9ce72014-05-15 22:47:33 +02001082The following performance enhancements have been added:
Victor Stinner01adf062014-03-18 00:53:32 +01001083
Victor Stinner37f20342015-03-10 13:29:41 +01001084* :func:`os.walk` has been sped up by 3-5x on POSIX systems and 7-20x
1085 on Windows. This was done using the new :func:`os.scandir` function,
1086 which exposes file information from the underlying ``readdir`` and
1087 ``FindFirstFile``/``FindNextFile`` system calls. (Contributed by
1088 Ben Hoyt with help from Victor Stinner in :issue:`23605`.)
1089
Brett Cannonf299abd2015-04-13 14:21:02 -04001090* Construction of ``bytes(int)`` (filled by zero bytes) is faster and uses less
Victor Stinner2bc4d952014-06-02 22:22:42 +02001091 memory for large objects. ``calloc()`` is used instead of ``malloc()`` to
Victor Stinnerdb067af2014-05-02 22:31:14 +02001092 allocate memory for these objects.
Victor Stinner01adf062014-03-18 00:53:32 +01001093
Antoine Pitrou0dfce562014-05-15 22:55:40 +02001094* Some operations on :class:`~ipaddress.IPv4Network` and
1095 :class:`~ipaddress.IPv6Network` have been massively sped up, such as
1096 :meth:`~ipaddress.IPv4Network.subnets`, :meth:`~ipaddress.IPv4Network.supernet`,
1097 :func:`~ipaddress.summarize_address_range`, :func:`~ipaddress.collapse_addresses`.
1098 The speed up can range from 3x to 15x.
1099 (:issue:`21486`, :issue:`21487`, :issue:`20826`)
1100
Serhiy Storchaka87d0b452015-02-03 11:30:10 +02001101* Many operations on :class:`io.BytesIO` are now 50% to 100% faster.
Berker Peksag9121fe82015-02-15 00:45:57 +02001102 (Contributed by Serhiy Storchaka in :issue:`15381` and David Wilson in
1103 :issue:`22003`.)
Serhiy Storchaka87d0b452015-02-03 11:30:10 +02001104
Serhiy Storchakac1efe5f2015-02-11 15:54:54 +02001105* :func:`marshal.dumps` is now faster (65%-85% with versions 3--4, 20-25% with
1106 versions 0--2 on typical data, and up to 5x in best cases).
1107 (Contributed by Serhiy Storchaka in :issue:`20416` and :issue:`23344`.)
Serhiy Storchakace921c622015-02-11 15:53:31 +02001108
Serhiy Storchaka0d4df752015-05-12 23:12:45 +03001109* The UTF-32 encoder is now 3x to 7x faster. (Contributed by Serhiy Storchaka
1110 in :issue:`15027`.)
1111
Victor Stinner01adf062014-03-18 00:53:32 +01001112
1113Build and C API Changes
1114=======================
1115
1116Changes to Python's build process and to the C API include:
1117
Victor Stinnerdb067af2014-05-02 22:31:14 +02001118* New ``calloc`` functions:
1119
1120 * :c:func:`PyMem_RawCalloc`
1121 * :c:func:`PyMem_Calloc`
1122 * :c:func:`PyObject_Calloc`
1123 * :c:func:`_PyObject_GC_Calloc`
Victor Stinner01adf062014-03-18 00:53:32 +01001124
Steve Dower313fbf42015-07-17 16:48:48 -07001125* Windows builds now require Microsoft Visual C++ 14.0, which
1126 is available as part of `Visual Studio 2015 <http://www.visualstudio.com>`_.
Victor Stinner01adf062014-03-18 00:53:32 +01001127
1128Deprecated
1129==========
1130
Yury Selivanov8fa6d4f2015-05-28 17:09:14 -04001131New Keywords
1132------------
1133
Yury Selivanov13b74ae2015-08-03 14:55:58 -04001134``async`` and ``await`` are not recommended to be used as variable, class,
1135function or module names. Introduced by :pep:`492` in Python 3.5, they will
1136become proper keywords in Python 3.7.
Yury Selivanov8fa6d4f2015-05-28 17:09:14 -04001137
1138
Victor Stinner01adf062014-03-18 00:53:32 +01001139Unsupported Operating Systems
1140-----------------------------
1141
Zachary Ware38019d12015-04-13 15:51:59 -05001142* Windows XP - Per :PEP:`11`, Microsoft support of Windows XP has ended.
Victor Stinner01adf062014-03-18 00:53:32 +01001143
1144
1145Deprecated Python modules, functions and methods
1146------------------------------------------------
1147
Brett Cannona77d0c32014-03-21 10:52:33 -04001148* The :mod:`formatter` module has now graduated to full deprecation and is still
1149 slated for removal in Python 3.6.
Victor Stinner01adf062014-03-18 00:53:32 +01001150
R David Murray554bcbf2014-06-11 11:18:08 -04001151* :mod:`smtpd` has in the past always decoded the DATA portion of email
1152 messages using the ``utf-8`` codec. This can now be controlled by the new
1153 *decode_data* keyword to :class:`~smtpd.SMTPServer`. The default value is
1154 ``True``, but this default is deprecated. Specify the *decode_data* keyword
1155 with an appropriate value to avoid the deprecation warning.
1156
R David Murray1813c172015-03-29 17:09:21 -04001157* Directly assigning values to the :attr:`~http.cookies.Morsel.key`,
1158 :attr:`~http.cookies.Morsel.value` and
1159 :attr:`~http.cookies.Morsel.coded_value` of :class:`~http.cookies.Morsel`
1160 objects is deprecated. Use the :func:`~http.cookies.Morsel.set` method
1161 instead. In addition, the undocumented *LegalChars* parameter of
1162 :func:`~http.cookies.Morsel.set` is deprecated, and is now ignored.
Serhiy Storchaka9c1a9b22015-03-18 10:59:57 +02001163
Serhiy Storchakab876df42015-03-24 22:30:46 +02001164* Passing a format string as keyword argument *format_string* to the
1165 :meth:`~string.Formatter.format` method of the :class:`string.Formatter`
1166 class has been deprecated.
1167
Berker Peksag2f3742b2015-05-13 12:32:20 +03001168* :func:`platform.dist` and :func:`platform.linux_distribution` functions are
1169 now deprecated and will be removed in Python 3.7. Linux distributions use
1170 too many different ways of describing themselves, so the functionality is
1171 left to a package.
1172 (Contributed by Vajrasky Kok and Berker Peksag in :issue:`1322`.)
Victor Stinner01adf062014-03-18 00:53:32 +01001173
Benjamin Petersonb1cc37c2015-05-20 22:09:43 -05001174* The previously undocumented ``from_function`` and ``from_builtin`` methods of
1175 :class:`inspect.Signature` are deprecated. Use new
Yury Selivanov57c74fc2015-05-20 23:07:02 -04001176 :meth:`inspect.Signature.from_callable` instead. (Contributed by Yury
1177 Selivanov in :issue:`24248`.)
1178
Yury Selivanov945fff42015-05-22 16:28:05 -04001179* :func:`inspect.getargspec` is deprecated and scheduled to be removed in
1180 Python 3.6. (See :issue:`20438` for details.)
1181
1182* :func:`~inspect.getfullargspec`, :func:`~inspect.getargvalues`,
1183 :func:`~inspect.getcallargs`, :func:`~inspect.getargvalues`,
1184 :func:`~inspect.formatargspec`, and :func:`~inspect.formatargvalues` are
1185 deprecated in favor of :func:`inspect.signature` API. (See :issue:`20438`
1186 for details.)
1187
1188
Victor Stinner01adf062014-03-18 00:53:32 +01001189Deprecated functions and types of the C API
1190-------------------------------------------
1191
1192* None yet.
1193
1194
1195Deprecated features
1196-------------------
1197
1198* None yet.
1199
1200
R David Murraydf75fee2014-10-03 13:02:47 -04001201Removed
1202=======
1203
Berker Peksag8f791d32014-11-01 10:45:57 +02001204API and Feature Removals
1205------------------------
1206
1207The following obsolete and previously deprecated APIs and features have been
1208removed:
1209
R David Murraydf75fee2014-10-03 13:02:47 -04001210* The ``__version__`` attribute has been dropped from the email package. The
1211 email code hasn't been shipped separately from the stdlib for a long time,
1212 and the ``__version__`` string was not updated in the last few releases.
1213
Berker Peksag8f791d32014-11-01 10:45:57 +02001214* The internal ``Netrc`` class in the :mod:`ftplib` module was deprecated in
Serhiy Storchakac1ded292014-11-02 19:22:02 +02001215 3.4, and has now been removed.
1216 (Contributed by Matt Chaput in :issue:`6623`.)
R David Murraydf75fee2014-10-03 13:02:47 -04001217
Brett Cannonf299abd2015-04-13 14:21:02 -04001218* The concept of ``.pyo`` files has been removed.
1219
R David Murraye81a7732015-04-12 18:47:56 -04001220* The JoinableQueue class in the provisional asyncio module was deprecated
1221 in 3.4.4 and is now removed (:issue:`23464`).
1222
1223
Victor Stinner01adf062014-03-18 00:53:32 +01001224Porting to Python 3.5
1225=====================
1226
1227This section lists previously described changes and other bugfixes
1228that may require changes to your code.
1229
Victor Stinnerdb067af2014-05-02 22:31:14 +02001230Changes in the Python API
1231-------------------------
1232
Victor Stinner6752d652015-07-29 01:11:10 +02001233* :pep:`475`: System calls are now retried when interrupted by a signal instead
1234 of raising :exc:`InterruptedError` if the Python signal handler does not
1235 raise an exception.
Victor Stinnera766ddf2015-03-26 23:50:57 +01001236
Benjamin Petersonee6bdc02014-03-20 18:00:35 -05001237* Before Python 3.5, a :class:`datetime.time` object was considered to be false
1238 if it represented midnight in UTC. This behavior was considered obscure and
1239 error-prone and has been removed in Python 3.5. See :issue:`13936` for full
1240 details.
Antoine Pitrou92c4d452014-04-29 10:05:59 +02001241
1242* :meth:`ssl.SSLSocket.send()` now raises either :exc:`ssl.SSLWantReadError`
1243 or :exc:`ssl.SSLWantWriteError` on a non-blocking socket if the operation
1244 would block. Previously, it would return 0. See :issue:`20951`.
Victor Stinnerdb067af2014-05-02 22:31:14 +02001245
Victor Stinner40ee3012014-06-16 15:59:28 +02001246* The ``__name__`` attribute of generator is now set from the function name,
1247 instead of being set from the code name. Use ``gen.gi_code.co_name`` to
1248 retrieve the code name. Generators also have a new ``__qualname__``
1249 attribute, the qualified name, which is now used for the representation
1250 of a generator (``repr(gen)``). See :issue:`21205`.
1251
Ezio Melotti045160b2014-08-02 18:54:30 +03001252* The deprecated "strict" mode and argument of :class:`~html.parser.HTMLParser`,
1253 :meth:`HTMLParser.error`, and the :exc:`HTMLParserError` exception have been
Serhiy Storchakac1ded292014-11-02 19:22:02 +02001254 removed. (Contributed by Ezio Melotti in :issue:`15114`.)
Ezio Melotti045160b2014-08-02 18:54:30 +03001255 The *convert_charrefs* argument of :class:`~html.parser.HTMLParser` is
Serhiy Storchakac1ded292014-11-02 19:22:02 +02001256 now ``True`` by default. (Contributed by Berker Peksag in :issue:`21047`.)
Ezio Melotti045160b2014-08-02 18:54:30 +03001257
R David Murray861470c2014-10-05 11:47:01 -04001258* Although it is not formally part of the API, it is worth noting for porting
1259 purposes (ie: fixing tests) that error messages that were previously of the
1260 form "'sometype' does not support the buffer protocol" are now of the form "a
Serhiy Storchakac1ded292014-11-02 19:22:02 +02001261 bytes-like object is required, not 'sometype'". (Contributed by Ezio Melotti
1262 in :issue:`16518`.)
R David Murray861470c2014-10-05 11:47:01 -04001263
Brett Cannonb6e25562014-11-21 12:19:28 -05001264* If the current directory is set to a directory that no longer exists then
1265 :exc:`FileNotFoundError` will no longer be raised and instead
1266 :meth:`~importlib.machinery.FileFinder.find_spec` will return ``None``
1267 **without** caching ``None`` in :data:`sys.path_importer_cache` which is
1268 different than the typical case (:issue:`22834`).
1269
Berker Peksag088ca8b2015-02-06 10:17:49 +02001270* HTTP status code and messages from :mod:`http.client` and :mod:`http.server`
1271 were refactored into a common :class:`~http.HTTPStatus` enum. The values in
1272 :mod:`http.client` and :mod:`http.server` remain available for backwards
1273 compatibility. (Contributed by Demian Brecht in :issue:`21793`.)
Serhiy Storchakae4db7692014-12-23 16:28:28 +02001274
Brett Cannon02d84542015-01-09 11:39:21 -05001275* When an import loader defines :meth:`~importlib.machinery.Loader.exec_module`
1276 it is now expected to also define
1277 :meth:`~importlib.machinery.Loader.create_module` (raises a
1278 :exc:`DeprecationWarning` now, will be an error in Python 3.6). If the loader
1279 inherits from :class:`importlib.abc.Loader` then there is nothing to do, else
1280 simply define :meth:`~importlib.machinery.Loader.create_module` to return
1281 ``None`` (:issue:`23014`).
1282
Serhiy Storchaka83e80272015-02-03 11:04:19 +02001283* :func:`re.split` always ignored empty pattern matches, so the ``'x*'``
1284 pattern worked the same as ``'x+'``, and the ``'\b'`` pattern never worked.
1285 Now :func:`re.split` raises a warning if the pattern could match
1286 an empty string. For compatibility use patterns that never match an empty
1287 string (e.g. ``'x+'`` instead of ``'x*'``). Patterns that could only match
1288 an empty string (such as ``'\b'``) now raise an error.
1289
R David Murray1813c172015-03-29 17:09:21 -04001290* The :class:`~http.cookies.Morsel` dict-like interface has been made self
1291 consistent: morsel comparison now takes the :attr:`~http.cookies.Morsel.key`
1292 and :attr:`~http.cookies.Morsel.value` into account,
1293 :meth:`~http.cookies.Morsel.copy` now results in a
R David Murrayba6ea9b2015-03-30 11:48:50 -04001294 :class:`~http.cookies.Morsel` instance rather than a :class:`dict`, and
1295 :meth:`~http.cookies.Morsel.update` will now raise an exception if any of the
R David Murray1813c172015-03-29 17:09:21 -04001296 keys in the update dictionary are invalid. In addition, the undocumented
1297 *LegalChars* parameter of :func:`~http.cookies.Morsel.set` is deprecated and
1298 is now ignored. (:issue:`2211`)
1299
Brett Cannonf299abd2015-04-13 14:21:02 -04001300* :pep:`488` has removed ``.pyo`` files from Python and introduced the optional
1301 ``opt-`` tag in ``.pyc`` file names. The
1302 :func:`importlib.util.cache_from_source` has gained an *optimization*
1303 parameter to help control the ``opt-`` tag. Because of this, the
1304 *debug_override* parameter of the function is now deprecated. `.pyo` files
1305 are also no longer supported as a file argument to the Python interpreter and
1306 thus serve no purpose when distributed on their own (i.e. sourcless code
1307 distribution). Due to the fact that the magic number for bytecode has changed
1308 in Python 3.5, all old `.pyo` files from previous versions of Python are
1309 invalid regardless of this PEP.
1310
Ned Deilycec3f562015-06-10 15:43:05 -07001311* The :mod:`socket` module now exports the CAN_RAW_FD_FRAMES constant on linux
1312 3.6 and greater.
Larry Hastingsa6cc5512015-04-13 17:48:40 -04001313
Zachary Ware3d3aedc2015-07-07 00:07:25 -05001314* The ``pygettext.py`` Tool now uses the standard +NNNN format for timezones in
R David Murray2b781292015-04-16 12:15:09 -04001315 the POT-Creation-Date header.
1316
R David Murray0c49b892015-04-16 17:14:42 -04001317* The :mod:`smtplib` module now uses :data:`sys.stderr` instead of previous
1318 module level :data:`stderr` variable for debug output. If your (test)
1319 program depends on patching the module level variable to capture the debug
1320 output, you will need to update it to capture sys.stderr instead.
1321
Serhiy Storchakad4ea03c2015-05-31 09:15:51 +03001322* The :meth:`str.startswith` and :meth:`str.endswith` methods no longer return
1323 ``True`` when finding the empty string and the indexes are completely out of
1324 range. See :issue:`24284`.
1325
Berker Peksag4333d8b2015-07-30 18:06:09 +03001326* The :func:`inspect.getdoc` function now returns documentation strings
1327 inherited from base classes. Documentation strings no longer need to be
1328 duplicated if the inherited documentation is appropriate. To suppress an
1329 inherited string, an empty string must be specified (or the documentation
1330 may be filled in). This change affects the output of the :mod:`pydoc`
1331 module and the :func:`help` function. See :issue:`15582`.
1332
Victor Stinnerdb067af2014-05-02 22:31:14 +02001333Changes in the C API
1334--------------------
1335
Stefan Krahf5324d72015-01-29 14:29:51 +01001336* The undocumented :c:member:`~PyMemoryViewObject.format` member of the
1337 (non-public) :c:type:`PyMemoryViewObject` structure has been removed.
1338
1339 All extensions relying on the relevant parts in ``memoryobject.h``
1340 must be rebuilt.
1341
Victor Stinnerd8f0d922014-06-02 21:57:10 +02001342* The :c:type:`PyMemAllocator` structure was renamed to
1343 :c:type:`PyMemAllocatorEx` and a new ``calloc`` field was added.
Serhiy Storchakadf4518c2014-11-18 23:34:33 +02001344
1345* Removed non-documented macro :c:macro:`PyObject_REPR` which leaked references.
1346 Use format character ``%R`` in :c:func:`PyUnicode_FromFormat`-like functions
1347 to format the :func:`repr` of the object.
Serhiy Storchaka490055a2015-03-01 10:03:02 +02001348
1349* Because the lack of the :attr:`__module__` attribute breaks pickling and
1350 introspection, a deprecation warning now is raised for builtin type without
1351 the :attr:`__module__` attribute. Would be an AttributeError in future.
1352 (:issue:`20204`)
Yury Selivanov50960882015-05-12 00:15:05 -04001353
Yury Selivanov5376ba92015-06-22 12:19:30 -04001354* As part of :pep:`492` implementation, ``tp_reserved`` slot of
Yury Selivanovf3e40fa2015-05-21 11:50:30 -04001355 :c:type:`PyTypeObject` was replaced with a
Yury Selivanov27947d52015-06-23 15:09:58 -04001356 :c:member:`tp_as_async` slot. Refer to :ref:`coro-objects` for
Yury Selivanov5376ba92015-06-22 12:19:30 -04001357 new types, structures and functions.