Zachary Ware | 569db2c | 2015-05-22 11:42:20 -0500 | [diff] [blame] | 1 | **************************** |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 2 | What's New In Python 3.5 |
| 3 | **************************** |
| 4 | |
| 5 | :Release: |release| |
| 6 | :Date: |today| |
| 7 | |
Yury Selivanov | dfcfe13 | 2015-09-08 15:33:15 -0400 | [diff] [blame^] | 8 | :Author: Elvis Pranskevichus <elprans@gmail.com> (Editor) |
| 9 | |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 10 | .. 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 | |
| 50 | This article explains the new features in Python 3.5, compared to 3.4. |
| 51 | |
| 52 | For full details, see the :source:`Misc/NEWS` file. |
| 53 | |
Benjamin Peterson | 52d1493 | 2015-03-27 16:07:35 -0400 | [diff] [blame] | 54 | .. 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 Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 59 | |
| 60 | |
| 61 | .. seealso:: |
| 62 | |
Berker Peksag | fa0423b | 2014-10-09 11:38:19 +0300 | [diff] [blame] | 63 | :pep:`478` - Python 3.5 Release Schedule |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 64 | |
| 65 | |
| 66 | Summary -- Release highlights |
| 67 | ============================= |
| 68 | |
Victor Stinner | 93692bb | 2015-03-30 15:04:45 +0200 | [diff] [blame] | 69 | .. This section singles out the most important changes in Python 3.5. |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 70 | Brevity is key. |
| 71 | |
| 72 | New syntax features: |
| 73 | |
Benjamin Peterson | 14ef1a1 | 2015-05-13 11:19:27 -0400 | [diff] [blame] | 74 | * :pep:`465`, a new matrix multiplication operator: ``a @ b``. |
| 75 | * :pep:`492`, coroutines with async and await syntax. |
Yury Selivanov | a5a0062 | 2015-08-04 12:52:16 -0400 | [diff] [blame] | 76 | * :pep:`448`, additional unpacking generalizations. |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 77 | |
| 78 | New library modules: |
| 79 | |
Brett Cannon | cc4dfc1 | 2015-03-13 10:40:49 -0400 | [diff] [blame] | 80 | * :mod:`zipapp`: :ref:`Improving Python ZIP Application Support |
| 81 | <whatsnew-zipapp>` (:pep:`441`). |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 82 | |
| 83 | New built-in features: |
| 84 | |
Victor Stinner | 93692bb | 2015-03-30 15:04:45 +0200 | [diff] [blame] | 85 | * ``bytes % args``, ``bytearray % args``: :pep:`461` - Adding ``%`` formatting |
| 86 | to bytes and bytearray |
Gregory P. Smith | 8cb6569 | 2015-04-25 23:22:26 +0000 | [diff] [blame] | 87 | * ``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 Selivanov | e13f8f3 | 2015-07-03 00:23:30 -0400 | [diff] [blame] | 90 | * 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 Selivanov | f488fb4 | 2015-07-03 01:04:23 -0400 | [diff] [blame] | 93 | * New :exc:`RecursionError` exception. (Contributed by Georg Brandl |
| 94 | in :issue:`19235`.) |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 95 | |
| 96 | Implementation improvements: |
| 97 | |
Victor Stinner | 7143029 | 2014-03-18 01:18:21 +0100 | [diff] [blame] | 98 | * 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 Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 102 | |
Brett Cannon | f299abd | 2015-04-13 14:21:02 -0400 | [diff] [blame] | 103 | * :pep:`488`, the elimination of ``.pyo`` files. |
Nick Coghlan | d5cacbb | 2015-05-23 22:24:10 +1000 | [diff] [blame] | 104 | * :pep:`489`, multi-phase initialization of extension modules. |
Brett Cannon | f299abd | 2015-04-13 14:21:02 -0400 | [diff] [blame] | 105 | |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 106 | Significantly Improved Library Modules: |
| 107 | |
Yury Selivanov | 5844436 | 2015-05-30 10:49:09 -0400 | [diff] [blame] | 108 | * :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. Smith | ad577b9 | 2015-05-22 16:18:14 -0700 | [diff] [blame] | 112 | * 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 Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 118 | |
Yury Selivanov | 7d6adab | 2015-08-05 19:01:51 -0400 | [diff] [blame] | 119 | * :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 Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 123 | Security improvements: |
| 124 | |
| 125 | * None yet. |
| 126 | |
Steve Dower | 313fbf4 | 2015-07-17 16:48:48 -0700 | [diff] [blame] | 127 | Windows 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 Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 135 | Please 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 Selivanov | dfcfe13 | 2015-09-08 15:33:15 -0400 | [diff] [blame^] | 154 | New Features |
| 155 | ============ |
| 156 | |
| 157 | .. _whatsnew-pep-492: |
| 158 | |
Yury Selivanov | f3e40fa | 2015-05-21 11:50:30 -0400 | [diff] [blame] | 159 | PEP 492 - Coroutines with async and await syntax |
| 160 | ------------------------------------------------ |
| 161 | |
Yury Selivanov | dfcfe13 | 2015-09-08 15:33:15 -0400 | [diff] [blame^] | 162 | :pep:`492` greatly improves support for asynchronous programming in Python |
| 163 | by adding :term:`awaitable objects <awaitable>`, |
| 164 | :term:`coroutine functions <coroutine function>`, |
| 165 | :term:`asynchronous iteration <asynchronous iterable>`, |
| 166 | and :term:`asynchronous context managers <asynchronous context manager>`. |
Yury Selivanov | f3e40fa | 2015-05-21 11:50:30 -0400 | [diff] [blame] | 167 | |
Yury Selivanov | dfcfe13 | 2015-09-08 15:33:15 -0400 | [diff] [blame^] | 168 | Coroutine functions are declared using the new :keyword:`async def` syntax:: |
Yury Selivanov | f3e40fa | 2015-05-21 11:50:30 -0400 | [diff] [blame] | 169 | |
Yury Selivanov | dfcfe13 | 2015-09-08 15:33:15 -0400 | [diff] [blame^] | 170 | >>> async def coro(): |
| 171 | ... return 'spam' |
Yury Selivanov | f3e40fa | 2015-05-21 11:50:30 -0400 | [diff] [blame] | 172 | |
Yury Selivanov | dfcfe13 | 2015-09-08 15:33:15 -0400 | [diff] [blame^] | 173 | Inside a coroutine function, a new :keyword:`await` expression can be used |
| 174 | to suspend coroutine execution until the result is available. Any object |
| 175 | can be *awaited*, as long as it implements the :term:`awaitable` protocol by |
| 176 | defining the :meth:`__await__` method. |
| 177 | |
| 178 | PEP 492 also adds :keyword:`async for` statement for convenient iteration |
| 179 | over asynchronous iterables. |
| 180 | |
| 181 | An 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 | |
| 207 | Similarly to asynchronous iteration, there is a new syntax for asynchronous |
| 208 | context 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 | |
| 237 | Note that both :keyword:`async for` and :keyword:`async with` can only |
| 238 | be used inside a coroutine function declared with :keyword:`async def`. |
| 239 | |
| 240 | Coroutine functions are intended to be ran inside a compatible event loop, |
| 241 | such as :class:`asyncio.Loop`. |
Yury Selivanov | f3e40fa | 2015-05-21 11:50:30 -0400 | [diff] [blame] | 242 | |
| 243 | .. seealso:: |
| 244 | |
| 245 | :pep:`492` -- Coroutines with async and await syntax |
Yury Selivanov | dfcfe13 | 2015-09-08 15:33:15 -0400 | [diff] [blame^] | 246 | PEP written and implemented by Yury Selivanov. |
Yury Selivanov | f3e40fa | 2015-05-21 11:50:30 -0400 | [diff] [blame] | 247 | |
| 248 | |
Yury Selivanov | dfcfe13 | 2015-09-08 15:33:15 -0400 | [diff] [blame^] | 249 | PEP 465 - A dedicated infix operator for matrix multiplication |
| 250 | -------------------------------------------------------------- |
Victor Stinner | 93692bb | 2015-03-30 15:04:45 +0200 | [diff] [blame] | 251 | |
Yury Selivanov | dfcfe13 | 2015-09-08 15:33:15 -0400 | [diff] [blame^] | 252 | :pep:`465` adds the ``@`` infix operator for matrix multiplication. |
| 253 | Currently, no builtin Python types implement the new operator, however, it |
| 254 | can be implemented by defining :meth:`__matmul__`, :meth:`__rmatmul__`, |
| 255 | and :meth:`__imatmul__` for regular, reflected, and in-place matrix |
| 256 | multiplication. The semantics of these methods is similar to that of |
| 257 | methods defining other infix arithmetic operators. |
| 258 | |
| 259 | Matrix multiplication is a notably common operation in many fields of |
| 260 | mathematics, science, engineering, and the addition of ``@`` allows writing |
| 261 | cleaner code:: |
| 262 | |
| 263 | >>> S = (H @ beta - r).T @ inv(H @ V @ H.T) @ (H @ beta - r) |
| 264 | |
| 265 | An 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 | |
| 289 | PEP 448 - Additional Unpacking Generalizations |
| 290 | ---------------------------------------------- |
| 291 | |
| 292 | :pep:`448` extends the allowed uses of the ``*`` iterable unpacking |
| 293 | operator and ``**`` dictionary unpacking operator. It is now possible |
| 294 | to 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 | |
| 306 | Similarly, tuple, list, set, and dictionary displays allow multiple |
| 307 | unpackings:: |
| 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 | |
| 325 | PEP 461 - % formatting support for bytes and bytearray |
| 326 | ------------------------------------------------------ |
| 327 | |
| 328 | PEP 461 adds % formatting to :class:`bytes` and :class:`bytearray`, aiding in |
| 329 | handling data that is a mixture of binary and ASCII compatible text. This |
| 330 | feature also eases porting such code from Python 2. |
Victor Stinner | 93692bb | 2015-03-30 15:04:45 +0200 | [diff] [blame] | 331 | |
| 332 | Examples:: |
| 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 | |
| 339 | Unicode 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 Selivanov | dfcfe13 | 2015-09-08 15:33:15 -0400 | [diff] [blame^] | 352 | PEP written by Ethan Furman; implemented by Neil Schemenauer and |
| 353 | Ethan Furman. |
Yury Selivanov | 216d999 | 2015-08-04 12:42:20 -0400 | [diff] [blame] | 354 | |
| 355 | |
Yury Selivanov | 5df36af | 2015-08-04 12:46:57 -0400 | [diff] [blame] | 356 | PEP 484 - Type Hints |
| 357 | -------------------- |
| 358 | |
| 359 | This PEP introduces a provisional module to provide these standard |
| 360 | definitions and tools, along with some conventions for situations |
| 361 | where annotations are not available. |
| 362 | |
| 363 | For example, here is a simple function whose argument and return type |
| 364 | are declared in the annotations:: |
| 365 | |
Yury Selivanov | dfcfe13 | 2015-09-08 15:33:15 -0400 | [diff] [blame^] | 366 | def greeting(name: str) -> str: |
| 367 | return 'Hello ' + name |
Yury Selivanov | 5df36af | 2015-08-04 12:46:57 -0400 | [diff] [blame] | 368 | |
| 369 | The type system supports unions, generic types, and a special type |
| 370 | named ``Any`` which is consistent with (i.e. assignable to and from) all |
| 371 | types. |
| 372 | |
| 373 | .. seealso:: |
| 374 | |
Yury Selivanov | 40c0ce4 | 2015-08-05 12:46:29 -0400 | [diff] [blame] | 375 | * :mod:`typing` module documentation |
Yury Selivanov | dfcfe13 | 2015-09-08 15:33:15 -0400 | [diff] [blame^] | 376 | * :pep:`484` -- Type Hints |
| 377 | PEP written by Guido van Rossum, Jukka Lehtosalo, and Łukasz Langa; |
| 378 | implemented by Guido van Rossum. |
Yury Selivanov | 5df36af | 2015-08-04 12:46:57 -0400 | [diff] [blame] | 379 | |
| 380 | |
Victor Stinner | 6036e44 | 2015-03-08 01:58:04 +0100 | [diff] [blame] | 381 | PEP 471 - os.scandir() function -- a better and faster directory iterator |
| 382 | ------------------------------------------------------------------------- |
| 383 | |
Victor Stinner | 37f2034 | 2015-03-10 13:29:41 +0100 | [diff] [blame] | 384 | :pep:`471` adds a new directory iteration function, :func:`os.scandir`, |
| 385 | to the standard library. Additionally, :func:`os.walk` is now |
| 386 | implemented using :func:`os.scandir`, which speeds it up by 3-5 times |
| 387 | on POSIX systems and by 7-20 times on Windows systems. |
| 388 | |
Victor Stinner | 6036e44 | 2015-03-08 01:58:04 +0100 | [diff] [blame] | 389 | .. seealso:: |
| 390 | |
Yury Selivanov | dfcfe13 | 2015-09-08 15:33:15 -0400 | [diff] [blame^] | 391 | :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 Stinner | 6036e44 | 2015-03-08 01:58:04 +0100 | [diff] [blame] | 393 | |
| 394 | |
Charles-François Natali | 6e6c59b | 2015-02-07 13:27:50 +0000 | [diff] [blame] | 395 | PEP 475: Retry system calls failing with EINTR |
| 396 | ---------------------------------------------- |
| 397 | |
Victor Stinner | f70e1ca | 2015-03-30 21:16:11 +0200 | [diff] [blame] | 398 | :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 |
| 400 | EINTR or :exc:`InterruptedError` manually, and should make it more robust |
| 401 | against asynchronous signal reception. |
Charles-François Natali | 6e6c59b | 2015-02-07 13:27:50 +0000 | [diff] [blame] | 402 | |
Victor Stinner | 6752d65 | 2015-07-29 01:11:10 +0200 | [diff] [blame] | 403 | Examples of functions which are now retried when interrupted by a signal |
| 404 | instead of raising :exc:`InterruptedError` if the Python signal handler does |
| 405 | not 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 Natali | 6e6c59b | 2015-02-07 13:27:50 +0000 | [diff] [blame] | 462 | .. seealso:: |
| 463 | |
| 464 | :pep:`475` -- Retry system calls failing with EINTR |
Yury Selivanov | dfcfe13 | 2015-09-08 15:33:15 -0400 | [diff] [blame^] | 465 | PEP and implementation written by Charles-François Natali and |
| 466 | Victor Stinner, with the help of Antoine Pitrou (the french connection). |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 467 | |
| 468 | |
Yury Selivanov | 8d006e7 | 2015-05-22 11:30:45 -0400 | [diff] [blame] | 469 | PEP 479: Change StopIteration handling inside generators |
| 470 | -------------------------------------------------------- |
| 471 | |
| 472 | :pep:`479` changes the behavior of generators: when a :exc:`StopIteration` |
| 473 | exception is raised inside a generator, it is replaced with a |
| 474 | :exc:`RuntimeError`. To enable the feature a ``__future__`` import should |
| 475 | be used:: |
| 476 | |
| 477 | from __future__ import generator_stop |
| 478 | |
| 479 | Without a ``__future__`` import, a :exc:`PendingDeprecationWarning` will be |
| 480 | raised. |
| 481 | |
Yury Selivanov | 8d006e7 | 2015-05-22 11:30:45 -0400 | [diff] [blame] | 482 | .. seealso:: |
| 483 | |
| 484 | :pep:`479` -- Change StopIteration handling inside generators |
Yury Selivanov | dfcfe13 | 2015-09-08 15:33:15 -0400 | [diff] [blame^] | 485 | PEP written by Chris Angelico and Guido van Rossum. Implemented by |
| 486 | Chris Angelico, Yury Selivanov and Nick Coghlan. |
Yury Selivanov | 8d006e7 | 2015-05-22 11:30:45 -0400 | [diff] [blame] | 487 | |
| 488 | |
Steve Dower | 76998fe | 2015-02-26 14:25:33 -0800 | [diff] [blame] | 489 | PEP 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 |
| 493 | virtual environment. When the default interpreter would be used and the |
| 494 | ``VIRTUAL_ENV`` environment variable is set, the interpreter in the virtual |
| 495 | environment will be used. |
| 496 | |
| 497 | .. seealso:: |
| 498 | |
| 499 | :pep:`486` -- Make the Python Launcher aware of virtual environments |
Yury Selivanov | dfcfe13 | 2015-09-08 15:33:15 -0400 | [diff] [blame^] | 500 | PEP written and implemented by Paul Moore. |
Steve Dower | 76998fe | 2015-02-26 14:25:33 -0800 | [diff] [blame] | 501 | |
Brett Cannon | f299abd | 2015-04-13 14:21:02 -0400 | [diff] [blame] | 502 | |
| 503 | PEP 488: Elimination of PYO files |
| 504 | --------------------------------- |
| 505 | |
| 506 | :pep:`488` does away with the concept of ``.pyo`` files. This means that |
Benjamin Peterson | e328323 | 2015-05-26 21:40:28 -0500 | [diff] [blame] | 507 | ``.pyc`` files represent both unoptimized and optimized bytecode. To prevent the |
| 508 | need to constantly regenerate bytecode files, ``.pyc`` files now have an |
| 509 | optional ``opt-`` tag in their name when the bytecode is optimized. This has the |
| 510 | side-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` |
| 513 | has an updated API to help with this change. |
Brett Cannon | f299abd | 2015-04-13 14:21:02 -0400 | [diff] [blame] | 514 | |
| 515 | .. seealso:: |
| 516 | |
| 517 | :pep:`488` -- Elimination of PYO files |
Yury Selivanov | dfcfe13 | 2015-09-08 15:33:15 -0400 | [diff] [blame^] | 518 | PEP written and implemented by Brett Cannon. |
Brett Cannon | f299abd | 2015-04-13 14:21:02 -0400 | [diff] [blame] | 519 | |
| 520 | |
Nick Coghlan | d5cacbb | 2015-05-23 22:24:10 +1000 | [diff] [blame] | 521 | PEP 489: Multi-phase extension module initialization |
| 522 | ---------------------------------------------------- |
| 523 | |
| 524 | :pep:`489` updates extension module initialization to take advantage of the |
| 525 | two step module loading mechanism introduced by :pep:`451` in Python 3.4. |
| 526 | |
| 527 | This change brings the import semantics of extension modules that opt-in to |
| 528 | using the new mechanism much closer to those of Python source and bytecode |
Nick Coghlan | 2ab5b09 | 2015-07-03 19:49:15 +1000 | [diff] [blame] | 529 | modules, including the ability to use any valid identifier as a module name, |
Nick Coghlan | d5cacbb | 2015-05-23 22:24:10 +1000 | [diff] [blame] | 530 | rather than being restricted to ASCII. |
| 531 | |
| 532 | .. seealso:: |
| 533 | |
Yury Selivanov | dfcfe13 | 2015-09-08 15:33:15 -0400 | [diff] [blame^] | 534 | :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 Coghlan | d5cacbb | 2015-05-23 22:24:10 +1000 | [diff] [blame] | 538 | |
Tal Einat | d5519ed | 2015-05-31 22:05:00 +0300 | [diff] [blame] | 539 | PEP 485: A function for testing approximate equality |
| 540 | ---------------------------------------------------- |
| 541 | |
| 542 | :pep:`485` adds the :func:`math.isclose` and :func:`cmath.isclose` |
| 543 | functions which tell whether two values are approximately equal or |
| 544 | "close" to each other. Whether or not two values are considered |
| 545 | close is determined according to given absolute and relative tolerances. |
| 546 | |
| 547 | .. seealso:: |
| 548 | |
| 549 | :pep:`485` -- A function for testing approximate equality |
Yury Selivanov | dfcfe13 | 2015-09-08 15:33:15 -0400 | [diff] [blame^] | 550 | PEP written by Christopher Barker; implemented by Chris Barker and |
| 551 | Tal Einat. |
| 552 | |
Tal Einat | d5519ed | 2015-05-31 22:05:00 +0300 | [diff] [blame] | 553 | |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 554 | Other Language Changes |
| 555 | ====================== |
| 556 | |
| 557 | Some smaller changes made to the core Python language are: |
| 558 | |
Serhiy Storchaka | 07985ef | 2015-01-25 22:56:57 +0200 | [diff] [blame] | 559 | * 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 Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 562 | |
Serhiy Storchaka | 1dd4982 | 2015-03-20 16:54:57 +0200 | [diff] [blame] | 563 | * The :option:`-b` option now affects comparisons of :class:`bytes` with |
| 564 | :class:`int`. (Contributed by Serhiy Storchaka in :issue:`23681`) |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 565 | |
Serhiy Storchaka | ad8a1c3 | 2015-05-12 23:16:55 +0300 | [diff] [blame] | 566 | * New Kazakh :ref:`codec <standard-encodings>` ``kz1048``. (Contributed by |
| 567 | Serhiy Storchaka in :issue:`22682`.) |
| 568 | |
Raymond Hettinger | eac503a | 2015-05-13 01:09:59 -0700 | [diff] [blame] | 569 | * 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 Storchaka | f0eeedf | 2015-05-12 23:24:19 +0300 | [diff] [blame] | 573 | * New Tajik :ref:`codec <standard-encodings>` ``koi8_t``. (Contributed by |
| 574 | Serhiy Storchaka in :issue:`22681`.) |
| 575 | |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 576 | |
| 577 | New Modules |
| 578 | =========== |
| 579 | |
Brett Cannon | cc4dfc1 | 2015-03-13 10:40:49 -0400 | [diff] [blame] | 580 | .. _whatsnew-zipapp: |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 581 | |
Brett Cannon | cc4dfc1 | 2015-03-13 10:40:49 -0400 | [diff] [blame] | 582 | zipapp |
| 583 | ------ |
| 584 | |
| 585 | The new :mod:`zipapp` module (specified in :pep:`441`) provides an API and |
| 586 | command line tool for creating executable Python Zip Applications, which |
| 587 | were introduced in Python 2.6 in :issue:`1739468` but which were not well |
| 588 | publicised, either at the time or since. |
| 589 | |
| 590 | With the new module, bundling your application is as simple as putting all |
| 591 | the files, including a ``__main__.py`` file, into a directory ``myapp`` |
| 592 | and running:: |
| 593 | |
| 594 | $ python -m zipapp myapp |
| 595 | $ python myapp.pyz |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 596 | |
| 597 | |
| 598 | Improved Modules |
| 599 | ================ |
| 600 | |
Berker Peksag | 8089cd6 | 2015-02-14 01:39:17 +0200 | [diff] [blame] | 601 | argparse |
| 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 Peksag | bf5e960 | 2015-02-06 10:21:37 +0200 | [diff] [blame] | 609 | cgi |
| 610 | --- |
| 611 | |
Berker Peksag | bd09d7b | 2015-02-11 15:32:34 +0200 | [diff] [blame] | 612 | * :class:`~cgi.FieldStorage` now supports the context management protocol. |
Berker Peksag | bf5e960 | 2015-02-06 10:21:37 +0200 | [diff] [blame] | 613 | (Contributed by Berker Peksag in :issue:`20289`.) |
| 614 | |
Tal Einat | d5519ed | 2015-05-31 22:05:00 +0300 | [diff] [blame] | 615 | cmath |
| 616 | ----- |
| 617 | |
| 618 | * :func:`cmath.isclose` function added. |
| 619 | (Contributed by Chris Barker and Tal Einat in :issue:`24270`.) |
| 620 | |
| 621 | |
R David Murray | c31e622 | 2014-09-29 11:25:00 -0400 | [diff] [blame] | 622 | code |
| 623 | ---- |
| 624 | |
| 625 | * The :func:`code.InteractiveInterpreter.showtraceback` method now prints |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 626 | the full chained traceback, just like the interactive interpreter. |
Berker Peksag | 088ca8b | 2015-02-06 10:17:49 +0200 | [diff] [blame] | 627 | (Contributed by Claudiu Popa in :issue:`17442`.) |
R David Murray | c31e622 | 2014-09-29 11:25:00 -0400 | [diff] [blame] | 628 | |
Raymond Hettinger | eac503a | 2015-05-13 01:09:59 -0700 | [diff] [blame] | 629 | collections |
| 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 Cannon | f1a8df0 | 2014-09-12 10:39:48 -0400 | [diff] [blame] | 641 | compileall |
| 642 | ---------- |
| 643 | |
| 644 | * :func:`compileall.compile_dir` and :mod:`compileall`'s command-line interface |
| 645 | can now do parallel bytecode compilation. |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 646 | (Contributed by Claudiu Popa in :issue:`16104`.) |
Brett Cannon | f1a8df0 | 2014-09-12 10:39:48 -0400 | [diff] [blame] | 647 | |
Berker Peksag | bb44fe0 | 2014-11-28 23:28:06 +0200 | [diff] [blame] | 648 | contextlib |
| 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 Dower | d2bc389 | 2015-04-15 18:06:05 -0400 | [diff] [blame] | 657 | curses |
| 658 | ------ |
| 659 | * The new :func:`curses.update_lines_cols` function updates the variables |
| 660 | :envvar:`curses.LINES` and :envvar:`curses.COLS`. |
| 661 | |
Berker Peksag | 102029d | 2015-03-15 01:18:47 +0200 | [diff] [blame] | 662 | difflib |
| 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 Ward | 4d9d256 | 2015-04-20 20:21:21 -0400 | [diff] [blame] | 670 | * It's now possible to compare lists of byte strings with |
| 671 | :func:`difflib.diff_bytes` (fixes a regression from Python 2). |
| 672 | |
Berker Peksag | 618e315 | 2015-01-27 02:59:09 +0200 | [diff] [blame] | 673 | distutils |
| 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 Storchaka | b9cec6a | 2015-05-16 22:13:27 +0300 | [diff] [blame] | 680 | * Added support for the LZMA compression. |
| 681 | (Contributed by Serhiy Storchaka in :issue:`16314`.) |
| 682 | |
Antoine Pitrou | b9d9ce7 | 2014-05-15 22:47:33 +0200 | [diff] [blame] | 683 | doctest |
| 684 | ------- |
Giampaolo Rodola' | e09fb71 | 2014-04-04 15:34:17 +0200 | [diff] [blame] | 685 | |
Antoine Pitrou | b9d9ce7 | 2014-05-15 22:47:33 +0200 | [diff] [blame] | 686 | * :func:`doctest.DocTestSuite` returns an empty :class:`unittest.TestSuite` if |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 687 | *module* contains no docstrings instead of raising :exc:`ValueError`. |
| 688 | (Contributed by Glenn Jones in :issue:`15916`.) |
Antoine Pitrou | b9d9ce7 | 2014-05-15 22:47:33 +0200 | [diff] [blame] | 689 | |
R David Murray | b744f3a | 2015-05-16 15:41:07 -0400 | [diff] [blame] | 690 | email |
| 691 | ----- |
| 692 | |
R David Murray | fdb23c2 | 2015-05-17 14:24:33 -0400 | [diff] [blame] | 693 | * 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 Murray | b744f3a | 2015-05-16 15:41:07 -0400 | [diff] [blame] | 699 | * 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 Murray | 224ef3e | 2015-05-17 11:29:21 -0400 | [diff] [blame] | 704 | * 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 Storchaka | c2edcdd | 2014-09-11 12:17:37 +0300 | [diff] [blame] | 710 | glob |
| 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 Rossum | 7ca1353 | 2015-05-23 15:27:51 -0700 | [diff] [blame] | 717 | idlelib and IDLE |
Terry Jan Reedy | 44825cf | 2015-05-23 18:19:42 -0400 | [diff] [blame] | 718 | ---------------- |
| 719 | |
| 720 | Since idlelib implements the IDLE shell and editor and is not intended for |
| 721 | import 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, |
| 723 | as well as changes made in future 3.5.x releases. This file is also available |
| 724 | from the IDLE Help -> About Idle dialog. |
| 725 | |
Serhiy Storchaka | 38684c3 | 2014-09-09 19:07:49 +0300 | [diff] [blame] | 726 | imaplib |
| 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 Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 732 | Serhiy Storchaka in :issue:`4972`.) |
Serhiy Storchaka | 38684c3 | 2014-09-09 19:07:49 +0300 | [diff] [blame] | 733 | |
R David Murray | a6429db | 2015-05-10 19:17:23 -0400 | [diff] [blame] | 734 | * :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 Murray | 2f60820 | 2014-06-26 12:27:57 -0400 | [diff] [blame] | 745 | imghdr |
| 746 | ------ |
| 747 | |
| 748 | * :func:`~imghdr.what` now recognizes the `OpenEXR <http://www.openexr.com>`_ |
Berker Peksag | 088ca8b | 2015-02-06 10:17:49 +0200 | [diff] [blame] | 749 | format. (Contributed by Martin Vignali and Claudiu Popa in :issue:`20295`.) |
R David Murray | 2f60820 | 2014-06-26 12:27:57 -0400 | [diff] [blame] | 750 | |
Antoine Pitrou | b9d9ce7 | 2014-05-15 22:47:33 +0200 | [diff] [blame] | 751 | importlib |
| 752 | --------- |
| 753 | |
| 754 | * :class:`importlib.util.LazyLoader` allows for the lazy loading of modules in |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 755 | applications where startup time is paramount. |
| 756 | (Contributed by Brett Cannon in :issue:`17621`.) |
Antoine Pitrou | b9d9ce7 | 2014-05-15 22:47:33 +0200 | [diff] [blame] | 757 | |
| 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 Cannon | 2a17bde | 2014-05-30 14:55:29 -0400 | [diff] [blame] | 763 | * :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 Pitrou | b9d9ce7 | 2014-05-15 22:47:33 +0200 | [diff] [blame] | 767 | inspect |
| 768 | ------- |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 769 | |
Yury Selivanov | a5d63dd | 2014-03-27 11:31:43 -0400 | [diff] [blame] | 770 | * :class:`inspect.Signature` and :class:`inspect.Parameter` are now |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 771 | picklable and hashable. (Contributed by Yury Selivanov in :issue:`20726` |
| 772 | and :issue:`20334`.) |
Yury Selivanov | a5d63dd | 2014-03-27 11:31:43 -0400 | [diff] [blame] | 773 | |
Yury Selivanov | b907a51 | 2015-05-16 13:45:09 -0400 | [diff] [blame] | 774 | * New method :meth:`inspect.BoundArguments.apply_defaults`. (Contributed |
| 775 | by Yury Selivanov in :issue:`24190`.) |
| 776 | |
Yury Selivanov | da39645 | 2014-03-27 12:09:24 -0400 | [diff] [blame] | 777 | * New class method :meth:`inspect.Signature.from_callable`, which makes |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 778 | subclassing of :class:`~inspect.Signature` easier. (Contributed |
| 779 | by Yury Selivanov and Eric Snow in :issue:`17373`.) |
Yury Selivanov | da39645 | 2014-03-27 12:09:24 -0400 | [diff] [blame] | 780 | |
Yury Selivanov | bcd4fc1 | 2015-05-20 14:30:08 -0400 | [diff] [blame] | 781 | * New argument ``follow_wrapped`` for :func:`inspect.signature`. |
| 782 | (Contributed by Yury Selivanov in :issue:`20691`.) |
| 783 | |
Yury Selivanov | fdbeb2b | 2015-07-03 13:11:35 -0400 | [diff] [blame] | 784 | * New :func:`~inspect.iscoroutine`, :func:`~inspect.iscoroutinefunction` |
| 785 | and :func:`~inspect.isawaitable` functions. (Contributed by |
| 786 | Yury Selivanov in :issue:`24017`.) |
Yury Selivanov | f3e40fa | 2015-05-21 11:50:30 -0400 | [diff] [blame] | 787 | |
Yury Selivanov | 5376ba9 | 2015-06-22 12:19:30 -0400 | [diff] [blame] | 788 | * New :func:`~inspect.getcoroutinelocals` and :func:`~inspect.getcoroutinestate` |
| 789 | functions. (Contributed by Yury Selivanov in :issue:`24400`.) |
| 790 | |
Antoine Pitrou | 0dfce56 | 2014-05-15 22:55:40 +0200 | [diff] [blame] | 791 | ipaddress |
| 792 | --------- |
| 793 | |
| 794 | * :class:`ipaddress.IPv4Network` and :class:`ipaddress.IPv6Network` now |
| 795 | accept an ``(address, netmask)`` tuple argument, so as to easily construct |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 796 | network objects from existing addresses. (Contributed by Peter Moody |
| 797 | and Antoine Pitrou in :issue:`16531`.) |
Antoine Pitrou | 0dfce56 | 2014-05-15 22:55:40 +0200 | [diff] [blame] | 798 | |
Berker Peksag | 39e4c4d | 2014-11-10 09:56:54 +0200 | [diff] [blame] | 799 | json |
| 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 Storchaka | 47efb4a | 2015-01-26 13:16:30 +0200 | [diff] [blame] | 807 | * JSON decoder now raises :exc:`json.JSONDecodeError` instead of |
| 808 | :exc:`ValueError`. (Contributed by Serhiy Storchaka in :issue:`19361`.) |
| 809 | |
Tal Einat | f67b0a3 | 2015-05-31 22:18:31 +0300 | [diff] [blame] | 810 | math |
| 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 Ware | 63f277b | 2014-06-19 09:46:37 -0500 | [diff] [blame] | 818 | os |
| 819 | -- |
| 820 | |
Victor Stinner | 37f2034 | 2015-03-10 13:29:41 +0100 | [diff] [blame] | 821 | * 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 Stinner | 6036e44 | 2015-03-08 01:58:04 +0100 | [diff] [blame] | 826 | |
Victor Stinner | e1d24f7 | 2014-07-24 12:44:07 +0200 | [diff] [blame] | 827 | * :class:`os.stat_result` now has a :attr:`~os.stat_result.st_file_attributes` |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 828 | attribute on Windows. (Contributed by Ben Hoyt in :issue:`21719`.) |
Zachary Ware | 63f277b | 2014-06-19 09:46:37 -0500 | [diff] [blame] | 829 | |
Victor Stinner | ace8848 | 2015-07-29 02:28:32 +0200 | [diff] [blame] | 830 | * :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 Storchaka | 3822093 | 2015-03-31 15:31:53 +0300 | [diff] [blame] | 835 | os.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 Hastings | d5b129c | 2015-08-24 12:49:22 -0700 | [diff] [blame] | 840 | path. (Contributed by Rafik Draoui and Serhiy Storchaka in :issue:`10395`.) |
Serhiy Storchaka | 3822093 | 2015-03-31 15:31:53 +0300 | [diff] [blame] | 841 | |
Serhiy Storchaka | 58e4134 | 2015-03-31 14:07:24 +0300 | [diff] [blame] | 842 | pickle |
| 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 Murray | b8cd3e4 | 2015-05-16 15:05:53 -0400 | [diff] [blame] | 849 | poplib |
| 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 Storchaka | 9baa5b2 | 2014-09-29 22:49:23 +0300 | [diff] [blame] | 856 | re |
| 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 Storchaka | 7438e4b | 2014-10-10 11:06:31 +0300 | [diff] [blame] | 862 | * 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 Murray | 6ffface | 2014-06-11 14:40:13 -0400 | [diff] [blame] | 865 | shutil |
| 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 Pitrou | b9d9ce7 | 2014-05-15 22:47:33 +0200 | [diff] [blame] | 873 | signal |
| 874 | ------ |
Brett Cannon | a04dbe4 | 2014-04-04 13:53:38 -0400 | [diff] [blame] | 875 | |
Victor Stinner | bbe3803 | 2015-04-01 16:32:32 +0200 | [diff] [blame] | 876 | * On Windows, :func:`signal.set_wakeup_fd` now also supports socket handles. |
| 877 | (Contributed by Victor Stinner in :issue:`22018`.) |
| 878 | |
Antoine Pitrou | b9d9ce7 | 2014-05-15 22:47:33 +0200 | [diff] [blame] | 879 | * 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 Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 881 | debugging, instead of integer “magic numbers”. (Contributed by Giampaolo |
| 882 | Rodola' in :issue:`21076`.) |
R David Murray | 1976d9b | 2014-04-14 20:28:36 -0400 | [diff] [blame] | 883 | |
R David Murray | 554bcbf | 2014-06-11 11:18:08 -0400 | [diff] [blame] | 884 | smtpd |
| 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 Murray | a33df31 | 2015-05-11 12:11:40 -0400 | [diff] [blame] | 892 | 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 Murray | 554bcbf | 2014-06-11 11:18:08 -0400 | [diff] [blame] | 909 | |
R David Murray | 6fe56a3 | 2014-06-11 13:48:58 -0400 | [diff] [blame] | 910 | * 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 Murray | 76e13c1 | 2014-07-03 14:47:46 -0400 | [diff] [blame] | 914 | smtplib |
| 915 | ------- |
| 916 | |
| 917 | * A new :meth:`~smtplib.SMTP.auth` method provides a convenient way to |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 918 | implement custom authentication mechanisms. |
| 919 | (Contributed by Milan Oberkirch in :issue:`15014`.) |
R David Murray | 76e13c1 | 2014-07-03 14:47:46 -0400 | [diff] [blame] | 920 | |
R David Murray | 0c49b89 | 2015-04-16 17:14:42 -0400 | [diff] [blame] | 921 | * 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 Murray | 8308444 | 2015-05-17 19:27:22 -0400 | [diff] [blame] | 925 | * :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 Murray | cee7cf6 | 2015-05-16 13:58:14 -0400 | [diff] [blame] | 929 | |
R David Murray | 4487dd0 | 2014-10-09 16:59:30 -0400 | [diff] [blame] | 930 | sndhdr |
| 931 | ------ |
| 932 | |
| 933 | * :func:`~sndhdr.what` and :func:`~sndhdr.whathdr` now return |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 934 | :func:`~collections.namedtuple`. |
| 935 | (Contributed by Claudiu Popa in :issue:`18615`.) |
R David Murray | 4487dd0 | 2014-10-09 16:59:30 -0400 | [diff] [blame] | 936 | |
Victor Stinner | 287452e | 2015-07-29 01:39:13 +0200 | [diff] [blame] | 937 | ssl |
| 938 | --- |
| 939 | |
Yury Selivanov | 7d6adab | 2015-08-05 19:01:51 -0400 | [diff] [blame] | 940 | * 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 Stinner | 287452e | 2015-07-29 01:39:13 +0200 | [diff] [blame] | 950 | |
Giampaolo Rodola' | 915d141 | 2014-06-11 03:54:30 +0200 | [diff] [blame] | 951 | socket |
| 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 Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 958 | (Contributed by Giampaolo Rodola' in :issue:`17552`.) |
Giampaolo Rodola' | 915d141 | 2014-06-11 03:54:30 +0200 | [diff] [blame] | 959 | |
Victor Stinner | 9881013 | 2015-07-29 01:41:25 +0200 | [diff] [blame] | 960 | * 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. Smith | 6e73000 | 2015-04-14 16:14:25 -0700 | [diff] [blame] | 964 | subprocess |
| 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 Selivanov | 4640b30 | 2015-05-31 17:21:38 -0400 | [diff] [blame] | 972 | sys |
| 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. Smith | 7a80389 | 2015-04-15 10:27:58 -0400 | [diff] [blame] | 978 | sysconfig |
| 979 | --------- |
| 980 | |
| 981 | * The user scripts directory on Windows is now versioned. |
| 982 | (Contributed by Paul Moore in :issue:`23437`.) |
| 983 | |
| 984 | tarfile |
| 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 Stinner | ae58649 | 2014-09-02 23:18:25 +0200 | [diff] [blame] | 997 | time |
| 998 | ---- |
| 999 | |
Berker Peksag | 882c95c | 2014-10-09 11:46:56 +0300 | [diff] [blame] | 1000 | * The :func:`time.monotonic` function is now always available. (Contributed by |
| 1001 | Victor Stinner in :issue:`22043`.) |
Victor Stinner | ae58649 | 2014-09-02 23:18:25 +0200 | [diff] [blame] | 1002 | |
Zachary Ware | 7dc9dea | 2015-05-22 11:36:53 -0500 | [diff] [blame] | 1003 | tkinter |
| 1004 | ------- |
| 1005 | |
Nick Coghlan | d5cacbb | 2015-05-23 22:24:10 +1000 | [diff] [blame] | 1006 | * The :mod:`tkinter._fix` module used for setting up the Tcl/Tk environment |
Berker Peksag | 1a90b17 | 2015-05-24 00:26:05 +0300 | [diff] [blame] | 1007 | on Windows has been replaced by a private function in the :mod:`_tkinter` |
Zachary Ware | 7dc9dea | 2015-05-22 11:36:53 -0500 | [diff] [blame] | 1008 | module which makes no permanent changes to environment variables. |
| 1009 | (Contributed by Zachary Ware in :issue:`20035`.) |
| 1010 | |
Yury Selivanov | f3e40fa | 2015-05-21 11:50:30 -0400 | [diff] [blame] | 1011 | types |
| 1012 | ----- |
| 1013 | |
| 1014 | * New :func:`~types.coroutine` function. (Contributed by Yury Selivanov |
| 1015 | in :issue:`24017`.) |
| 1016 | |
Yury Selivanov | 5376ba9 | 2015-06-22 12:19:30 -0400 | [diff] [blame] | 1017 | * New :class:`~types.CoroutineType`. (Contributed by Yury Selivanov |
| 1018 | in :issue:`24400`.) |
| 1019 | |
Berker Peksag | bd09d7b | 2015-02-11 15:32:34 +0200 | [diff] [blame] | 1020 | urllib |
| 1021 | ------ |
Nick Coghlan | c216c48 | 2014-11-12 23:33:50 +1000 | [diff] [blame] | 1022 | |
R David Murray | 4c7f995 | 2015-04-16 16:36:18 -0400 | [diff] [blame] | 1023 | * 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 Coghlan | c216c48 | 2014-11-12 23:33:50 +1000 | [diff] [blame] | 1030 | |
R David Murray | c17686f | 2015-05-17 20:44:50 -0400 | [diff] [blame] | 1031 | * 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 Peterson | 4801383 | 2015-06-27 15:45:56 -0500 | [diff] [blame] | 1035 | unicodedata |
| 1036 | ----------- |
| 1037 | |
| 1038 | * The :mod:`unicodedata` module now uses data from `Unicode 8.0.0 |
Nick Coghlan | 2ab5b09 | 2015-07-03 19:49:15 +1000 | [diff] [blame] | 1039 | <http://unicode.org/versions/Unicode8.0.0/>`_. |
Benjamin Peterson | 4801383 | 2015-06-27 15:45:56 -0500 | [diff] [blame] | 1040 | |
| 1041 | |
Berker Peksag | 3e88722 | 2014-07-02 08:37:22 +0300 | [diff] [blame] | 1042 | wsgiref |
| 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 Pitrou | b9d9ce7 | 2014-05-15 22:47:33 +0200 | [diff] [blame] | 1048 | xmlrpc |
| 1049 | ------ |
| 1050 | |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 1051 | * :class:`xmlrpc.client.ServerProxy` is now a :term:`context manager`. |
| 1052 | (Contributed by Claudiu Popa in :issue:`20627`.) |
Brett Cannon | 6eaac13 | 2014-05-09 12:28:22 -0400 | [diff] [blame] | 1053 | |
Serhiy Storchaka | 61de087 | 2015-04-02 21:00:13 +0300 | [diff] [blame] | 1054 | xml.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 Stinner | 95bb714 | 2015-03-12 15:32:03 +0100 | [diff] [blame] | 1061 | faulthandler |
| 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 Storchaka | 77d8997 | 2015-03-23 01:09:35 +0200 | [diff] [blame] | 1069 | zipfile |
| 1070 | ------- |
| 1071 | |
| 1072 | * Added support for writing ZIP files to unseekable streams. |
| 1073 | (Contributed by Serhiy Storchaka in :issue:`23252`.) |
| 1074 | |
Serhiy Storchaka | 764fc9b | 2015-03-25 10:09:41 +0200 | [diff] [blame] | 1075 | * The :func:`zipfile.ZipFile.open` function now supports ``'x'`` (exclusive |
| 1076 | creation) mode. (Contributed by Serhiy Storchaka in :issue:`21717`.) |
| 1077 | |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 1078 | |
| 1079 | Optimizations |
| 1080 | ============= |
| 1081 | |
Antoine Pitrou | b9d9ce7 | 2014-05-15 22:47:33 +0200 | [diff] [blame] | 1082 | The following performance enhancements have been added: |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 1083 | |
Victor Stinner | 37f2034 | 2015-03-10 13:29:41 +0100 | [diff] [blame] | 1084 | * :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 Cannon | f299abd | 2015-04-13 14:21:02 -0400 | [diff] [blame] | 1090 | * Construction of ``bytes(int)`` (filled by zero bytes) is faster and uses less |
Victor Stinner | 2bc4d95 | 2014-06-02 22:22:42 +0200 | [diff] [blame] | 1091 | memory for large objects. ``calloc()`` is used instead of ``malloc()`` to |
Victor Stinner | db067af | 2014-05-02 22:31:14 +0200 | [diff] [blame] | 1092 | allocate memory for these objects. |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 1093 | |
Antoine Pitrou | 0dfce56 | 2014-05-15 22:55:40 +0200 | [diff] [blame] | 1094 | * 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 Storchaka | 87d0b45 | 2015-02-03 11:30:10 +0200 | [diff] [blame] | 1101 | * Many operations on :class:`io.BytesIO` are now 50% to 100% faster. |
Berker Peksag | 9121fe8 | 2015-02-15 00:45:57 +0200 | [diff] [blame] | 1102 | (Contributed by Serhiy Storchaka in :issue:`15381` and David Wilson in |
| 1103 | :issue:`22003`.) |
Serhiy Storchaka | 87d0b45 | 2015-02-03 11:30:10 +0200 | [diff] [blame] | 1104 | |
Serhiy Storchaka | c1efe5f | 2015-02-11 15:54:54 +0200 | [diff] [blame] | 1105 | * :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 Storchaka | ce921c62 | 2015-02-11 15:53:31 +0200 | [diff] [blame] | 1108 | |
Serhiy Storchaka | 0d4df75 | 2015-05-12 23:12:45 +0300 | [diff] [blame] | 1109 | * The UTF-32 encoder is now 3x to 7x faster. (Contributed by Serhiy Storchaka |
| 1110 | in :issue:`15027`.) |
| 1111 | |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 1112 | |
| 1113 | Build and C API Changes |
| 1114 | ======================= |
| 1115 | |
| 1116 | Changes to Python's build process and to the C API include: |
| 1117 | |
Victor Stinner | db067af | 2014-05-02 22:31:14 +0200 | [diff] [blame] | 1118 | * 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 Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 1124 | |
Steve Dower | 313fbf4 | 2015-07-17 16:48:48 -0700 | [diff] [blame] | 1125 | * Windows builds now require Microsoft Visual C++ 14.0, which |
| 1126 | is available as part of `Visual Studio 2015 <http://www.visualstudio.com>`_. |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 1127 | |
| 1128 | Deprecated |
| 1129 | ========== |
| 1130 | |
Yury Selivanov | 8fa6d4f | 2015-05-28 17:09:14 -0400 | [diff] [blame] | 1131 | New Keywords |
| 1132 | ------------ |
| 1133 | |
Yury Selivanov | 13b74ae | 2015-08-03 14:55:58 -0400 | [diff] [blame] | 1134 | ``async`` and ``await`` are not recommended to be used as variable, class, |
| 1135 | function or module names. Introduced by :pep:`492` in Python 3.5, they will |
| 1136 | become proper keywords in Python 3.7. |
Yury Selivanov | 8fa6d4f | 2015-05-28 17:09:14 -0400 | [diff] [blame] | 1137 | |
| 1138 | |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 1139 | Unsupported Operating Systems |
| 1140 | ----------------------------- |
| 1141 | |
Zachary Ware | 38019d1 | 2015-04-13 15:51:59 -0500 | [diff] [blame] | 1142 | * Windows XP - Per :PEP:`11`, Microsoft support of Windows XP has ended. |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 1143 | |
| 1144 | |
| 1145 | Deprecated Python modules, functions and methods |
| 1146 | ------------------------------------------------ |
| 1147 | |
Brett Cannon | a77d0c3 | 2014-03-21 10:52:33 -0400 | [diff] [blame] | 1148 | * The :mod:`formatter` module has now graduated to full deprecation and is still |
| 1149 | slated for removal in Python 3.6. |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 1150 | |
R David Murray | 554bcbf | 2014-06-11 11:18:08 -0400 | [diff] [blame] | 1151 | * :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 Murray | 1813c17 | 2015-03-29 17:09:21 -0400 | [diff] [blame] | 1157 | * 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 Storchaka | 9c1a9b2 | 2015-03-18 10:59:57 +0200 | [diff] [blame] | 1163 | |
Serhiy Storchaka | b876df4 | 2015-03-24 22:30:46 +0200 | [diff] [blame] | 1164 | * 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 Peksag | 2f3742b | 2015-05-13 12:32:20 +0300 | [diff] [blame] | 1168 | * :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 Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 1173 | |
Benjamin Peterson | b1cc37c | 2015-05-20 22:09:43 -0500 | [diff] [blame] | 1174 | * The previously undocumented ``from_function`` and ``from_builtin`` methods of |
| 1175 | :class:`inspect.Signature` are deprecated. Use new |
Yury Selivanov | 57c74fc | 2015-05-20 23:07:02 -0400 | [diff] [blame] | 1176 | :meth:`inspect.Signature.from_callable` instead. (Contributed by Yury |
| 1177 | Selivanov in :issue:`24248`.) |
| 1178 | |
Yury Selivanov | 945fff4 | 2015-05-22 16:28:05 -0400 | [diff] [blame] | 1179 | * :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 Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 1189 | Deprecated functions and types of the C API |
| 1190 | ------------------------------------------- |
| 1191 | |
| 1192 | * None yet. |
| 1193 | |
| 1194 | |
| 1195 | Deprecated features |
| 1196 | ------------------- |
| 1197 | |
| 1198 | * None yet. |
| 1199 | |
| 1200 | |
R David Murray | df75fee | 2014-10-03 13:02:47 -0400 | [diff] [blame] | 1201 | Removed |
| 1202 | ======= |
| 1203 | |
Berker Peksag | 8f791d3 | 2014-11-01 10:45:57 +0200 | [diff] [blame] | 1204 | API and Feature Removals |
| 1205 | ------------------------ |
| 1206 | |
| 1207 | The following obsolete and previously deprecated APIs and features have been |
| 1208 | removed: |
| 1209 | |
R David Murray | df75fee | 2014-10-03 13:02:47 -0400 | [diff] [blame] | 1210 | * 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 Peksag | 8f791d3 | 2014-11-01 10:45:57 +0200 | [diff] [blame] | 1214 | * The internal ``Netrc`` class in the :mod:`ftplib` module was deprecated in |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 1215 | 3.4, and has now been removed. |
| 1216 | (Contributed by Matt Chaput in :issue:`6623`.) |
R David Murray | df75fee | 2014-10-03 13:02:47 -0400 | [diff] [blame] | 1217 | |
Brett Cannon | f299abd | 2015-04-13 14:21:02 -0400 | [diff] [blame] | 1218 | * The concept of ``.pyo`` files has been removed. |
| 1219 | |
R David Murray | e81a773 | 2015-04-12 18:47:56 -0400 | [diff] [blame] | 1220 | * The JoinableQueue class in the provisional asyncio module was deprecated |
| 1221 | in 3.4.4 and is now removed (:issue:`23464`). |
| 1222 | |
| 1223 | |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 1224 | Porting to Python 3.5 |
| 1225 | ===================== |
| 1226 | |
| 1227 | This section lists previously described changes and other bugfixes |
| 1228 | that may require changes to your code. |
| 1229 | |
Victor Stinner | db067af | 2014-05-02 22:31:14 +0200 | [diff] [blame] | 1230 | Changes in the Python API |
| 1231 | ------------------------- |
| 1232 | |
Victor Stinner | 6752d65 | 2015-07-29 01:11:10 +0200 | [diff] [blame] | 1233 | * :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 Stinner | a766ddf | 2015-03-26 23:50:57 +0100 | [diff] [blame] | 1236 | |
Benjamin Peterson | ee6bdc0 | 2014-03-20 18:00:35 -0500 | [diff] [blame] | 1237 | * 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 Pitrou | 92c4d45 | 2014-04-29 10:05:59 +0200 | [diff] [blame] | 1241 | |
| 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 Stinner | db067af | 2014-05-02 22:31:14 +0200 | [diff] [blame] | 1245 | |
Victor Stinner | 40ee301 | 2014-06-16 15:59:28 +0200 | [diff] [blame] | 1246 | * 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 Melotti | 045160b | 2014-08-02 18:54:30 +0300 | [diff] [blame] | 1252 | * The deprecated "strict" mode and argument of :class:`~html.parser.HTMLParser`, |
| 1253 | :meth:`HTMLParser.error`, and the :exc:`HTMLParserError` exception have been |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 1254 | removed. (Contributed by Ezio Melotti in :issue:`15114`.) |
Ezio Melotti | 045160b | 2014-08-02 18:54:30 +0300 | [diff] [blame] | 1255 | The *convert_charrefs* argument of :class:`~html.parser.HTMLParser` is |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 1256 | now ``True`` by default. (Contributed by Berker Peksag in :issue:`21047`.) |
Ezio Melotti | 045160b | 2014-08-02 18:54:30 +0300 | [diff] [blame] | 1257 | |
R David Murray | 861470c | 2014-10-05 11:47:01 -0400 | [diff] [blame] | 1258 | * 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 Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 1261 | bytes-like object is required, not 'sometype'". (Contributed by Ezio Melotti |
| 1262 | in :issue:`16518`.) |
R David Murray | 861470c | 2014-10-05 11:47:01 -0400 | [diff] [blame] | 1263 | |
Brett Cannon | b6e2556 | 2014-11-21 12:19:28 -0500 | [diff] [blame] | 1264 | * 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 Peksag | 088ca8b | 2015-02-06 10:17:49 +0200 | [diff] [blame] | 1270 | * 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 Storchaka | e4db769 | 2014-12-23 16:28:28 +0200 | [diff] [blame] | 1274 | |
Brett Cannon | 02d8454 | 2015-01-09 11:39:21 -0500 | [diff] [blame] | 1275 | * 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 Storchaka | 83e8027 | 2015-02-03 11:04:19 +0200 | [diff] [blame] | 1283 | * :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 Murray | 1813c17 | 2015-03-29 17:09:21 -0400 | [diff] [blame] | 1290 | * 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 Murray | ba6ea9b | 2015-03-30 11:48:50 -0400 | [diff] [blame] | 1294 | :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 Murray | 1813c17 | 2015-03-29 17:09:21 -0400 | [diff] [blame] | 1296 | 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 Cannon | f299abd | 2015-04-13 14:21:02 -0400 | [diff] [blame] | 1300 | * :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 Deily | cec3f56 | 2015-06-10 15:43:05 -0700 | [diff] [blame] | 1311 | * The :mod:`socket` module now exports the CAN_RAW_FD_FRAMES constant on linux |
| 1312 | 3.6 and greater. |
Larry Hastings | a6cc551 | 2015-04-13 17:48:40 -0400 | [diff] [blame] | 1313 | |
Zachary Ware | 3d3aedc | 2015-07-07 00:07:25 -0500 | [diff] [blame] | 1314 | * The ``pygettext.py`` Tool now uses the standard +NNNN format for timezones in |
R David Murray | 2b78129 | 2015-04-16 12:15:09 -0400 | [diff] [blame] | 1315 | the POT-Creation-Date header. |
| 1316 | |
R David Murray | 0c49b89 | 2015-04-16 17:14:42 -0400 | [diff] [blame] | 1317 | * 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 Storchaka | d4ea03c | 2015-05-31 09:15:51 +0300 | [diff] [blame] | 1322 | * 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 Peksag | 4333d8b | 2015-07-30 18:06:09 +0300 | [diff] [blame] | 1326 | * 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 Stinner | db067af | 2014-05-02 22:31:14 +0200 | [diff] [blame] | 1333 | Changes in the C API |
| 1334 | -------------------- |
| 1335 | |
Stefan Krah | f5324d7 | 2015-01-29 14:29:51 +0100 | [diff] [blame] | 1336 | * 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 Stinner | d8f0d92 | 2014-06-02 21:57:10 +0200 | [diff] [blame] | 1342 | * The :c:type:`PyMemAllocator` structure was renamed to |
| 1343 | :c:type:`PyMemAllocatorEx` and a new ``calloc`` field was added. |
Serhiy Storchaka | df4518c | 2014-11-18 23:34:33 +0200 | [diff] [blame] | 1344 | |
| 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 Storchaka | 490055a | 2015-03-01 10:03:02 +0200 | [diff] [blame] | 1348 | |
| 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 Selivanov | 5096088 | 2015-05-12 00:15:05 -0400 | [diff] [blame] | 1353 | |
Yury Selivanov | 5376ba9 | 2015-06-22 12:19:30 -0400 | [diff] [blame] | 1354 | * As part of :pep:`492` implementation, ``tp_reserved`` slot of |
Yury Selivanov | f3e40fa | 2015-05-21 11:50:30 -0400 | [diff] [blame] | 1355 | :c:type:`PyTypeObject` was replaced with a |
Yury Selivanov | 27947d5 | 2015-06-23 15:09:58 -0400 | [diff] [blame] | 1356 | :c:member:`tp_as_async` slot. Refer to :ref:`coro-objects` for |
Yury Selivanov | 5376ba9 | 2015-06-22 12:19:30 -0400 | [diff] [blame] | 1357 | new types, structures and functions. |