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 | |
| 8 | .. Rules for maintenance: |
| 9 | |
| 10 | * Anyone can add text to this document. Do not spend very much time |
| 11 | on the wording of your changes, because your text will probably |
| 12 | get rewritten to some degree. |
| 13 | |
| 14 | * The maintainer will go through Misc/NEWS periodically and add |
| 15 | changes; it's therefore more important to add your changes to |
| 16 | Misc/NEWS than to this file. |
| 17 | |
| 18 | * This is not a complete list of every single change; completeness |
| 19 | is the purpose of Misc/NEWS. Some changes I consider too small |
| 20 | or esoteric to include. If such a change is added to the text, |
| 21 | I'll just remove it. (This is another reason you shouldn't spend |
| 22 | too much time on writing your addition.) |
| 23 | |
| 24 | * If you want to draw your new text to the attention of the |
| 25 | maintainer, add 'XXX' to the beginning of the paragraph or |
| 26 | section. |
| 27 | |
| 28 | * It's OK to just add a fragmentary note about a change. For |
| 29 | example: "XXX Describe the transmogrify() function added to the |
| 30 | socket module." The maintainer will research the change and |
| 31 | write the necessary text. |
| 32 | |
| 33 | * You can comment out your additions if you like, but it's not |
| 34 | necessary (especially when a final release is some months away). |
| 35 | |
| 36 | * Credit the author of a patch or bugfix. Just the name is |
| 37 | sufficient; the e-mail address isn't necessary. |
| 38 | |
| 39 | * It's helpful to add the bug/patch number as a comment: |
| 40 | |
| 41 | XXX Describe the transmogrify() function added to the socket |
| 42 | module. |
| 43 | (Contributed by P.Y. Developer in :issue:`12345`.) |
| 44 | |
| 45 | This saves the maintainer the effort of going through the Mercurial log |
| 46 | when researching a change. |
| 47 | |
| 48 | This article explains the new features in Python 3.5, compared to 3.4. |
| 49 | |
| 50 | For full details, see the :source:`Misc/NEWS` file. |
| 51 | |
Benjamin Peterson | 52d1493 | 2015-03-27 16:07:35 -0400 | [diff] [blame] | 52 | .. note:: |
| 53 | |
| 54 | Prerelease users should be aware that this document is currently in draft |
| 55 | form. It will be updated substantially as Python 3.5 moves towards release, |
| 56 | so it's worth checking back even after reading earlier versions. |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 57 | |
| 58 | |
| 59 | .. seealso:: |
| 60 | |
Berker Peksag | fa0423b | 2014-10-09 11:38:19 +0300 | [diff] [blame] | 61 | :pep:`478` - Python 3.5 Release Schedule |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 62 | |
| 63 | |
| 64 | Summary -- Release highlights |
| 65 | ============================= |
| 66 | |
Victor Stinner | 93692bb | 2015-03-30 15:04:45 +0200 | [diff] [blame] | 67 | .. This section singles out the most important changes in Python 3.5. |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 68 | Brevity is key. |
| 69 | |
| 70 | New syntax features: |
| 71 | |
Benjamin Peterson | 14ef1a1 | 2015-05-13 11:19:27 -0400 | [diff] [blame] | 72 | * :pep:`465`, a new matrix multiplication operator: ``a @ b``. |
| 73 | * :pep:`492`, coroutines with async and await syntax. |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 74 | |
| 75 | New library modules: |
| 76 | |
Brett Cannon | cc4dfc1 | 2015-03-13 10:40:49 -0400 | [diff] [blame] | 77 | * :mod:`zipapp`: :ref:`Improving Python ZIP Application Support |
| 78 | <whatsnew-zipapp>` (:pep:`441`). |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 79 | |
| 80 | New built-in features: |
| 81 | |
Victor Stinner | 93692bb | 2015-03-30 15:04:45 +0200 | [diff] [blame] | 82 | * ``bytes % args``, ``bytearray % args``: :pep:`461` - Adding ``%`` formatting |
| 83 | to bytes and bytearray |
Gregory P. Smith | 8cb6569 | 2015-04-25 23:22:26 +0000 | [diff] [blame] | 84 | * ``b'\xf0\x9f\x90\x8d'.hex()``, ``bytearray(b'\xf0\x9f\x90\x8d').hex()``, |
| 85 | ``memoryview(b'\xf0\x9f\x90\x8d').hex()``: :issue:`9951` - A ``hex`` method |
| 86 | has been added to bytes, bytearray, and memoryview. |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 87 | |
| 88 | Implementation improvements: |
| 89 | |
Victor Stinner | 7143029 | 2014-03-18 01:18:21 +0100 | [diff] [blame] | 90 | * When the ``LC_TYPE`` locale is the POSIX locale (``C`` locale), |
| 91 | :py:data:`sys.stdin` and :py:data:`sys.stdout` are now using the |
| 92 | ``surrogateescape`` error handler, instead of the ``strict`` error handler |
| 93 | (:issue:`19977`). |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 94 | |
Brett Cannon | f299abd | 2015-04-13 14:21:02 -0400 | [diff] [blame] | 95 | * :pep:`488`, the elimination of ``.pyo`` files. |
Nick Coghlan | d5cacbb | 2015-05-23 22:24:10 +1000 | [diff] [blame^] | 96 | * :pep:`489`, multi-phase initialization of extension modules. |
Brett Cannon | f299abd | 2015-04-13 14:21:02 -0400 | [diff] [blame] | 97 | |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 98 | Significantly Improved Library Modules: |
| 99 | |
Gregory P. Smith | ad577b9 | 2015-05-22 16:18:14 -0700 | [diff] [blame] | 100 | * You may now pass bytes to the :mod:`tempfile` module's APIs and it will |
| 101 | return the temporary pathname as bytes instead of str. It also accepts |
| 102 | a value of ``None`` on parameters where only str was accepted in the past to |
| 103 | do the right thing based on the types of the other inputs. Two functions, |
| 104 | :func:`gettempdirb` and :func:`gettempprefixb`, have been added to go along |
| 105 | with this. This behavior matches that of the :mod:`os` APIs. |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 106 | |
| 107 | Security improvements: |
| 108 | |
| 109 | * None yet. |
| 110 | |
| 111 | Please read on for a comprehensive list of user-facing changes. |
| 112 | |
| 113 | |
| 114 | .. PEP-sized items next. |
| 115 | |
| 116 | .. _pep-4XX: |
| 117 | |
| 118 | .. PEP 4XX: Virtual Environments |
| 119 | .. ============================= |
| 120 | |
| 121 | |
| 122 | .. (Implemented by Foo Bar.) |
| 123 | |
| 124 | .. .. seealso:: |
| 125 | |
| 126 | :pep:`4XX` - Python Virtual Environments |
| 127 | PEP written by Carl Meyer |
| 128 | |
| 129 | |
Yury Selivanov | f3e40fa | 2015-05-21 11:50:30 -0400 | [diff] [blame] | 130 | PEP 492 - Coroutines with async and await syntax |
| 131 | ------------------------------------------------ |
| 132 | |
| 133 | The PEP added dedicated syntax for declaring :term:`coroutines <coroutine>`, |
| 134 | :keyword:`await` expressions, new asynchronous :keyword:`async for` |
| 135 | and :keyword:`async with` statements. |
| 136 | |
| 137 | Example:: |
| 138 | |
| 139 | async def read_data(db): |
| 140 | async with db.transaction(): |
| 141 | data = await db.fetch('SELECT ...') |
| 142 | |
| 143 | PEP written and implemented by Yury Selivanov. |
| 144 | |
| 145 | .. seealso:: |
| 146 | |
| 147 | :pep:`492` -- Coroutines with async and await syntax |
| 148 | |
| 149 | |
Benjamin Peterson | 5562c903 | 2015-05-13 11:19:06 -0400 | [diff] [blame] | 150 | PEP 461 - Adding formatting to bytes and bytearray |
| 151 | -------------------------------------------------- |
Victor Stinner | 93692bb | 2015-03-30 15:04:45 +0200 | [diff] [blame] | 152 | |
| 153 | This PEP proposes adding % formatting operations similar to Python 2's ``str`` |
| 154 | type to :class:`bytes` and :class:`bytearray`. |
| 155 | |
| 156 | Examples:: |
| 157 | |
| 158 | >>> b'Hello %s!' % b'World' |
| 159 | b'Hello World!' |
| 160 | >>> b'x=%i y=%f' % (1, 2.5) |
| 161 | b'x=1 y=2.500000' |
| 162 | |
| 163 | Unicode is not allowed for ``%s``, but it is accepted by ``%a`` (equivalent of |
| 164 | ``repr(obj).encode('ascii', 'backslashreplace')``):: |
| 165 | |
| 166 | >>> b'Hello %s!' % 'World' |
| 167 | Traceback (most recent call last): |
| 168 | File "<stdin>", line 1, in <module> |
| 169 | TypeError: %b requires bytes, or an object that implements __bytes__, not 'str' |
| 170 | >>> b'price: %a' % '10€' |
| 171 | b"price: '10\\u20ac'" |
| 172 | |
| 173 | .. seealso:: |
| 174 | |
| 175 | :pep:`461` -- Adding % formatting to bytes and bytearray |
| 176 | |
| 177 | |
| 178 | PEP 465 - A dedicated infix operator for matrix multiplication |
| 179 | -------------------------------------------------------------- |
| 180 | |
| 181 | This PEP proposes a new binary operator to be used for matrix multiplication, |
R David Murray | ef2a397 | 2015-04-01 09:15:02 -0400 | [diff] [blame] | 182 | called ``@``. (Mnemonic: ``@`` is ``*`` for mATrices.) |
Victor Stinner | 93692bb | 2015-03-30 15:04:45 +0200 | [diff] [blame] | 183 | |
| 184 | .. seealso:: |
| 185 | |
| 186 | :pep:`465` -- A dedicated infix operator for matrix multiplication |
| 187 | |
Victor Stinner | 6036e44 | 2015-03-08 01:58:04 +0100 | [diff] [blame] | 188 | |
| 189 | PEP 471 - os.scandir() function -- a better and faster directory iterator |
| 190 | ------------------------------------------------------------------------- |
| 191 | |
Victor Stinner | 37f2034 | 2015-03-10 13:29:41 +0100 | [diff] [blame] | 192 | :pep:`471` adds a new directory iteration function, :func:`os.scandir`, |
| 193 | to the standard library. Additionally, :func:`os.walk` is now |
| 194 | implemented using :func:`os.scandir`, which speeds it up by 3-5 times |
| 195 | on POSIX systems and by 7-20 times on Windows systems. |
| 196 | |
| 197 | PEP and implementation written by Ben Hoyt with the help of Victor Stinner. |
Victor Stinner | 6036e44 | 2015-03-08 01:58:04 +0100 | [diff] [blame] | 198 | |
| 199 | .. seealso:: |
| 200 | |
| 201 | :pep:`471` -- os.scandir() function -- a better and faster directory |
Victor Stinner | 37f2034 | 2015-03-10 13:29:41 +0100 | [diff] [blame] | 202 | iterator |
Victor Stinner | 6036e44 | 2015-03-08 01:58:04 +0100 | [diff] [blame] | 203 | |
| 204 | |
Charles-François Natali | 6e6c59b | 2015-02-07 13:27:50 +0000 | [diff] [blame] | 205 | PEP 475: Retry system calls failing with EINTR |
| 206 | ---------------------------------------------- |
| 207 | |
Victor Stinner | f70e1ca | 2015-03-30 21:16:11 +0200 | [diff] [blame] | 208 | :pep:`475` adds support for automatic retry of system calls failing with |
| 209 | :py:data:`~errno.EINTR`: this means that user code doesn't have to deal with |
| 210 | EINTR or :exc:`InterruptedError` manually, and should make it more robust |
| 211 | against asynchronous signal reception. |
Charles-François Natali | 6e6c59b | 2015-02-07 13:27:50 +0000 | [diff] [blame] | 212 | |
| 213 | .. seealso:: |
| 214 | |
| 215 | :pep:`475` -- Retry system calls failing with EINTR |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 216 | |
| 217 | |
Yury Selivanov | 8d006e7 | 2015-05-22 11:30:45 -0400 | [diff] [blame] | 218 | PEP 479: Change StopIteration handling inside generators |
| 219 | -------------------------------------------------------- |
| 220 | |
| 221 | :pep:`479` changes the behavior of generators: when a :exc:`StopIteration` |
| 222 | exception is raised inside a generator, it is replaced with a |
| 223 | :exc:`RuntimeError`. To enable the feature a ``__future__`` import should |
| 224 | be used:: |
| 225 | |
| 226 | from __future__ import generator_stop |
| 227 | |
| 228 | Without a ``__future__`` import, a :exc:`PendingDeprecationWarning` will be |
| 229 | raised. |
| 230 | |
| 231 | PEP written by Chris Angelico and Guido van Rossum. Implemented by |
| 232 | Chris Angelico, Yury Selivanov and Nick Coghlan. |
| 233 | |
| 234 | .. seealso:: |
| 235 | |
| 236 | :pep:`479` -- Change StopIteration handling inside generators |
| 237 | |
| 238 | |
Steve Dower | 76998fe | 2015-02-26 14:25:33 -0800 | [diff] [blame] | 239 | PEP 486: Make the Python Launcher aware of virtual environments |
| 240 | --------------------------------------------------------------- |
| 241 | |
| 242 | :pep:`486` makes the Windows launcher (see :pep:`397`) aware of an active |
| 243 | virtual environment. When the default interpreter would be used and the |
| 244 | ``VIRTUAL_ENV`` environment variable is set, the interpreter in the virtual |
| 245 | environment will be used. |
| 246 | |
| 247 | .. seealso:: |
| 248 | |
| 249 | :pep:`486` -- Make the Python Launcher aware of virtual environments |
| 250 | |
Brett Cannon | f299abd | 2015-04-13 14:21:02 -0400 | [diff] [blame] | 251 | |
| 252 | PEP 488: Elimination of PYO files |
| 253 | --------------------------------- |
| 254 | |
| 255 | :pep:`488` does away with the concept of ``.pyo`` files. This means that |
| 256 | ``.pyc`` files represent both unoptimized and optimized bytecode. To prevent |
| 257 | the need to constantly regenerate bytecode files, ``.pyc`` files now have an |
| 258 | optional ``opt-`` tag in their name when the bytecode is optimized. This has |
| 259 | the side-effect of no more bytecode file name clashes when running under either |
| 260 | ``-O`` or ``-OO``, thus allowing unoptimized, ``-O``, and ``-OO`` bytecode files |
| 261 | to all exist simultaneously. :func:`importlib.util.cache_from_source` has an |
| 262 | updated API to help with this change. |
| 263 | |
| 264 | .. seealso:: |
| 265 | |
| 266 | :pep:`488` -- Elimination of PYO files |
| 267 | |
| 268 | |
Nick Coghlan | d5cacbb | 2015-05-23 22:24:10 +1000 | [diff] [blame^] | 269 | PEP 489: Multi-phase extension module initialization |
| 270 | ---------------------------------------------------- |
| 271 | |
| 272 | :pep:`489` updates extension module initialization to take advantage of the |
| 273 | two step module loading mechanism introduced by :pep:`451` in Python 3.4. |
| 274 | |
| 275 | This change brings the import semantics of extension modules that opt-in to |
| 276 | using the new mechanism much closer to those of Python source and bytecode |
| 277 | modules, including the ability to any valid identifier as a module name, |
| 278 | rather than being restricted to ASCII. |
| 279 | |
| 280 | .. seealso:: |
| 281 | |
| 282 | :pep:`488` -- Multi-phase extension module initialization |
| 283 | |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 284 | Other Language Changes |
| 285 | ====================== |
| 286 | |
| 287 | Some smaller changes made to the core Python language are: |
| 288 | |
Serhiy Storchaka | 07985ef | 2015-01-25 22:56:57 +0200 | [diff] [blame] | 289 | * Added the ``'namereplace'`` error handlers. The ``'backslashreplace'`` |
| 290 | error handlers now works with decoding and translating. |
| 291 | (Contributed by Serhiy Storchaka in :issue:`19676` and :issue:`22286`.) |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 292 | |
Serhiy Storchaka | 1dd4982 | 2015-03-20 16:54:57 +0200 | [diff] [blame] | 293 | * The :option:`-b` option now affects comparisons of :class:`bytes` with |
| 294 | :class:`int`. (Contributed by Serhiy Storchaka in :issue:`23681`) |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 295 | |
Serhiy Storchaka | ad8a1c3 | 2015-05-12 23:16:55 +0300 | [diff] [blame] | 296 | * New Kazakh :ref:`codec <standard-encodings>` ``kz1048``. (Contributed by |
| 297 | Serhiy Storchaka in :issue:`22682`.) |
| 298 | |
Raymond Hettinger | eac503a | 2015-05-13 01:09:59 -0700 | [diff] [blame] | 299 | * Property docstrings are now writable. This is especially useful for |
| 300 | :func:`collections.namedtuple` docstrings. |
| 301 | (Contributed by Berker Peksag in :issue:`24064`.) |
| 302 | |
Serhiy Storchaka | f0eeedf | 2015-05-12 23:24:19 +0300 | [diff] [blame] | 303 | * New Tajik :ref:`codec <standard-encodings>` ``koi8_t``. (Contributed by |
| 304 | Serhiy Storchaka in :issue:`22681`.) |
| 305 | |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 306 | |
| 307 | New Modules |
| 308 | =========== |
| 309 | |
Brett Cannon | cc4dfc1 | 2015-03-13 10:40:49 -0400 | [diff] [blame] | 310 | .. _whatsnew-zipapp: |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 311 | |
Brett Cannon | cc4dfc1 | 2015-03-13 10:40:49 -0400 | [diff] [blame] | 312 | zipapp |
| 313 | ------ |
| 314 | |
| 315 | The new :mod:`zipapp` module (specified in :pep:`441`) provides an API and |
| 316 | command line tool for creating executable Python Zip Applications, which |
| 317 | were introduced in Python 2.6 in :issue:`1739468` but which were not well |
| 318 | publicised, either at the time or since. |
| 319 | |
| 320 | With the new module, bundling your application is as simple as putting all |
| 321 | the files, including a ``__main__.py`` file, into a directory ``myapp`` |
| 322 | and running:: |
| 323 | |
| 324 | $ python -m zipapp myapp |
| 325 | $ python myapp.pyz |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 326 | |
| 327 | |
| 328 | Improved Modules |
| 329 | ================ |
| 330 | |
Berker Peksag | 8089cd6 | 2015-02-14 01:39:17 +0200 | [diff] [blame] | 331 | argparse |
| 332 | -------- |
| 333 | |
| 334 | * :class:`~argparse.ArgumentParser` now allows to disable |
| 335 | :ref:`abbreviated usage <prefix-matching>` of long options by setting |
| 336 | :ref:`allow_abbrev` to ``False``. |
| 337 | (Contributed by Jonathan Paugh, Steven Bethard, paul j3 and Daniel Eriksson.) |
| 338 | |
Berker Peksag | bf5e960 | 2015-02-06 10:21:37 +0200 | [diff] [blame] | 339 | cgi |
| 340 | --- |
| 341 | |
Berker Peksag | bd09d7b | 2015-02-11 15:32:34 +0200 | [diff] [blame] | 342 | * :class:`~cgi.FieldStorage` now supports the context management protocol. |
Berker Peksag | bf5e960 | 2015-02-06 10:21:37 +0200 | [diff] [blame] | 343 | (Contributed by Berker Peksag in :issue:`20289`.) |
| 344 | |
R David Murray | c31e622 | 2014-09-29 11:25:00 -0400 | [diff] [blame] | 345 | code |
| 346 | ---- |
| 347 | |
| 348 | * The :func:`code.InteractiveInterpreter.showtraceback` method now prints |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 349 | the full chained traceback, just like the interactive interpreter. |
Berker Peksag | 088ca8b | 2015-02-06 10:17:49 +0200 | [diff] [blame] | 350 | (Contributed by Claudiu Popa in :issue:`17442`.) |
R David Murray | c31e622 | 2014-09-29 11:25:00 -0400 | [diff] [blame] | 351 | |
Raymond Hettinger | eac503a | 2015-05-13 01:09:59 -0700 | [diff] [blame] | 352 | collections |
| 353 | ----------- |
| 354 | |
| 355 | * You can now update docstrings produced by :func:`collections.namedtuple`:: |
| 356 | |
| 357 | Point = namedtuple('Point', ['x', 'y']) |
| 358 | Point.__doc__ = 'ordered pair' |
| 359 | Point.x.__doc__ = 'abscissa' |
| 360 | Point.y.__doc__ = 'ordinate' |
| 361 | |
| 362 | (Contributed by Berker Peksag in :issue:`24064`.) |
| 363 | |
Brett Cannon | f1a8df0 | 2014-09-12 10:39:48 -0400 | [diff] [blame] | 364 | compileall |
| 365 | ---------- |
| 366 | |
| 367 | * :func:`compileall.compile_dir` and :mod:`compileall`'s command-line interface |
| 368 | can now do parallel bytecode compilation. |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 369 | (Contributed by Claudiu Popa in :issue:`16104`.) |
Brett Cannon | f1a8df0 | 2014-09-12 10:39:48 -0400 | [diff] [blame] | 370 | |
Berker Peksag | bb44fe0 | 2014-11-28 23:28:06 +0200 | [diff] [blame] | 371 | contextlib |
| 372 | ---------- |
| 373 | |
| 374 | * The new :func:`contextlib.redirect_stderr` context manager(similar to |
| 375 | :func:`contextlib.redirect_stdout`) makes it easier for utility scripts to |
| 376 | handle inflexible APIs that write their output to :data:`sys.stderr` and |
| 377 | don't provide any options to redirect it. |
| 378 | (Contributed by Berker Peksag in :issue:`22389`.) |
| 379 | |
Steve Dower | d2bc389 | 2015-04-15 18:06:05 -0400 | [diff] [blame] | 380 | curses |
| 381 | ------ |
| 382 | * The new :func:`curses.update_lines_cols` function updates the variables |
| 383 | :envvar:`curses.LINES` and :envvar:`curses.COLS`. |
| 384 | |
Berker Peksag | 102029d | 2015-03-15 01:18:47 +0200 | [diff] [blame] | 385 | difflib |
| 386 | ------- |
| 387 | |
| 388 | * The charset of the HTML document generated by :meth:`difflib.HtmlDiff.make_file` |
| 389 | can now be customized by using *charset* keyword-only parameter. The default |
| 390 | charset of HTML document changed from ``'ISO-8859-1'`` to ``'utf-8'``. |
| 391 | (Contributed by Berker Peksag in :issue:`2052`.) |
| 392 | |
Greg Ward | 4d9d256 | 2015-04-20 20:21:21 -0400 | [diff] [blame] | 393 | * It's now possible to compare lists of byte strings with |
| 394 | :func:`difflib.diff_bytes` (fixes a regression from Python 2). |
| 395 | |
Berker Peksag | 618e315 | 2015-01-27 02:59:09 +0200 | [diff] [blame] | 396 | distutils |
| 397 | --------- |
| 398 | |
| 399 | * The ``build`` and ``build_ext`` commands now accept a ``-j`` |
| 400 | option to enable parallel building of extension modules. |
| 401 | (Contributed by Antoine Pitrou in :issue:`5309`.) |
| 402 | |
Serhiy Storchaka | b9cec6a | 2015-05-16 22:13:27 +0300 | [diff] [blame] | 403 | * Added support for the LZMA compression. |
| 404 | (Contributed by Serhiy Storchaka in :issue:`16314`.) |
| 405 | |
Antoine Pitrou | b9d9ce7 | 2014-05-15 22:47:33 +0200 | [diff] [blame] | 406 | doctest |
| 407 | ------- |
Giampaolo Rodola' | e09fb71 | 2014-04-04 15:34:17 +0200 | [diff] [blame] | 408 | |
Antoine Pitrou | b9d9ce7 | 2014-05-15 22:47:33 +0200 | [diff] [blame] | 409 | * :func:`doctest.DocTestSuite` returns an empty :class:`unittest.TestSuite` if |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 410 | *module* contains no docstrings instead of raising :exc:`ValueError`. |
| 411 | (Contributed by Glenn Jones in :issue:`15916`.) |
Antoine Pitrou | b9d9ce7 | 2014-05-15 22:47:33 +0200 | [diff] [blame] | 412 | |
R David Murray | b744f3a | 2015-05-16 15:41:07 -0400 | [diff] [blame] | 413 | email |
| 414 | ----- |
| 415 | |
R David Murray | fdb23c2 | 2015-05-17 14:24:33 -0400 | [diff] [blame] | 416 | * A new policy option :attr:`~email.policy.Policy.mangle_from_` controls |
| 417 | whether or not lines that start with "From " in email bodies are prefixed with |
| 418 | a '>' character by generators. The default is ``True`` for |
| 419 | :attr:`~email.policy.compat32` and ``False`` for all other policies. |
| 420 | (Contributed by Milan Oberkirch in :issue:`20098`.) |
| 421 | |
R David Murray | b744f3a | 2015-05-16 15:41:07 -0400 | [diff] [blame] | 422 | * A new method :meth:`~email.message.Message.get_content_disposition` provides |
| 423 | easy access to a canonical value for the :mailheader:`Content-Disposition` |
| 424 | header (``None`` if there is no such header). (Contributed by Abhilash Raj |
| 425 | in :issue:`21083`.) |
| 426 | |
R David Murray | 224ef3e | 2015-05-17 11:29:21 -0400 | [diff] [blame] | 427 | * A new policy option :attr:`~email.policy.EmailPolicy.utf8` can be set |
| 428 | ``True`` to encode email headers using the utf8 charset instead of using |
| 429 | encoded words. This allows ``Messages`` to be formatted according to |
| 430 | :rfc:`6532` and used with an SMTP server that supports the :rfc:`6531` |
| 431 | ``SMTPUTF8`` extension. (Contributed by R. David Murray in :issue:`24211`.) |
| 432 | |
Serhiy Storchaka | c2edcdd | 2014-09-11 12:17:37 +0300 | [diff] [blame] | 433 | glob |
| 434 | ---- |
| 435 | |
| 436 | * :func:`~glob.iglob` and :func:`~glob.glob` now support recursive search in |
| 437 | subdirectories using the "``**``" pattern. |
| 438 | (Contributed by Serhiy Storchaka in :issue:`13968`.) |
| 439 | |
Serhiy Storchaka | 38684c3 | 2014-09-09 19:07:49 +0300 | [diff] [blame] | 440 | imaplib |
| 441 | ------- |
| 442 | |
| 443 | * :class:`IMAP4` now supports the context management protocol. When used in a |
| 444 | :keyword:`with` statement, the IMAP4 ``LOGOUT`` command will be called |
| 445 | automatically at the end of the block. (Contributed by Tarek Ziadé and |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 446 | Serhiy Storchaka in :issue:`4972`.) |
Serhiy Storchaka | 38684c3 | 2014-09-09 19:07:49 +0300 | [diff] [blame] | 447 | |
R David Murray | a6429db | 2015-05-10 19:17:23 -0400 | [diff] [blame] | 448 | * :mod:`imaplib` now supports :rfc:`5161`: the :meth:`~imaplib.IMAP4.enable` |
| 449 | extension), and :rfc:`6855`: utf-8 support (internationalized email, via the |
| 450 | ``UTF8=ACCEPT`` argument to :meth:`~imaplib.IMAP4.enable`). A new attribute, |
| 451 | :attr:`~imaplib.IMAP4.utf8_enabled`, tracks whether or not :rfc:`6855` |
| 452 | support is enabled. Milan Oberkirch, R. David Murray, and Maciej Szulik in |
| 453 | :issue:`21800`.) |
| 454 | |
| 455 | * :mod:`imaplib` now automatically encodes non-ASCII string usernames and |
| 456 | passwords using ``UTF8``, as recommended by the RFCs. (Contributed by Milan |
| 457 | Oberkirch in :issue:`21800`.) |
| 458 | |
R David Murray | 2f60820 | 2014-06-26 12:27:57 -0400 | [diff] [blame] | 459 | imghdr |
| 460 | ------ |
| 461 | |
| 462 | * :func:`~imghdr.what` now recognizes the `OpenEXR <http://www.openexr.com>`_ |
Berker Peksag | 088ca8b | 2015-02-06 10:17:49 +0200 | [diff] [blame] | 463 | format. (Contributed by Martin Vignali and Claudiu Popa in :issue:`20295`.) |
R David Murray | 2f60820 | 2014-06-26 12:27:57 -0400 | [diff] [blame] | 464 | |
Antoine Pitrou | b9d9ce7 | 2014-05-15 22:47:33 +0200 | [diff] [blame] | 465 | importlib |
| 466 | --------- |
| 467 | |
| 468 | * :class:`importlib.util.LazyLoader` allows for the lazy loading of modules in |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 469 | applications where startup time is paramount. |
| 470 | (Contributed by Brett Cannon in :issue:`17621`.) |
Antoine Pitrou | b9d9ce7 | 2014-05-15 22:47:33 +0200 | [diff] [blame] | 471 | |
| 472 | * :func:`importlib.abc.InspectLoader.source_to_code` is now a |
| 473 | static method to make it easier to work with source code in a string. |
| 474 | With a module object that you want to initialize you can then use |
| 475 | ``exec(code, module.__dict__)`` to execute the code in the module. |
| 476 | |
Brett Cannon | 2a17bde | 2014-05-30 14:55:29 -0400 | [diff] [blame] | 477 | * :func:`importlib.util.module_from_spec` is now the preferred way to create a |
| 478 | new module. Compared to :class:`types.ModuleType`, this new function will set |
| 479 | the various import-controlled attributes based on the passed-in spec object. |
| 480 | |
Antoine Pitrou | b9d9ce7 | 2014-05-15 22:47:33 +0200 | [diff] [blame] | 481 | inspect |
| 482 | ------- |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 483 | |
Yury Selivanov | a5d63dd | 2014-03-27 11:31:43 -0400 | [diff] [blame] | 484 | * :class:`inspect.Signature` and :class:`inspect.Parameter` are now |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 485 | picklable and hashable. (Contributed by Yury Selivanov in :issue:`20726` |
| 486 | and :issue:`20334`.) |
Yury Selivanov | a5d63dd | 2014-03-27 11:31:43 -0400 | [diff] [blame] | 487 | |
Yury Selivanov | b907a51 | 2015-05-16 13:45:09 -0400 | [diff] [blame] | 488 | * New method :meth:`inspect.BoundArguments.apply_defaults`. (Contributed |
| 489 | by Yury Selivanov in :issue:`24190`.) |
| 490 | |
Yury Selivanov | da39645 | 2014-03-27 12:09:24 -0400 | [diff] [blame] | 491 | * New class method :meth:`inspect.Signature.from_callable`, which makes |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 492 | subclassing of :class:`~inspect.Signature` easier. (Contributed |
| 493 | by Yury Selivanov and Eric Snow in :issue:`17373`.) |
Yury Selivanov | da39645 | 2014-03-27 12:09:24 -0400 | [diff] [blame] | 494 | |
Yury Selivanov | bcd4fc1 | 2015-05-20 14:30:08 -0400 | [diff] [blame] | 495 | * New argument ``follow_wrapped`` for :func:`inspect.signature`. |
| 496 | (Contributed by Yury Selivanov in :issue:`20691`.) |
| 497 | |
Yury Selivanov | f3e40fa | 2015-05-21 11:50:30 -0400 | [diff] [blame] | 498 | * New :func:`~inspect.iscoroutine`, :func:`~inspect.iscoroutinefunction`, |
| 499 | and :func:`~inspect.isawaitable` functions. (Contributed by Yury Selivanov |
| 500 | in :issue:`24017`.) |
| 501 | |
Antoine Pitrou | 0dfce56 | 2014-05-15 22:55:40 +0200 | [diff] [blame] | 502 | ipaddress |
| 503 | --------- |
| 504 | |
| 505 | * :class:`ipaddress.IPv4Network` and :class:`ipaddress.IPv6Network` now |
| 506 | accept an ``(address, netmask)`` tuple argument, so as to easily construct |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 507 | network objects from existing addresses. (Contributed by Peter Moody |
| 508 | and Antoine Pitrou in :issue:`16531`.) |
Antoine Pitrou | 0dfce56 | 2014-05-15 22:55:40 +0200 | [diff] [blame] | 509 | |
Berker Peksag | 39e4c4d | 2014-11-10 09:56:54 +0200 | [diff] [blame] | 510 | json |
| 511 | ---- |
| 512 | |
| 513 | * The output of :mod:`json.tool` command line interface is now in the same |
| 514 | order as the input. Use the :option:`--sort-keys` option to sort the output |
| 515 | of dictionaries alphabetically by key. (Contributed by Berker Peksag in |
| 516 | :issue:`21650`.) |
| 517 | |
Serhiy Storchaka | 47efb4a | 2015-01-26 13:16:30 +0200 | [diff] [blame] | 518 | * JSON decoder now raises :exc:`json.JSONDecodeError` instead of |
| 519 | :exc:`ValueError`. (Contributed by Serhiy Storchaka in :issue:`19361`.) |
| 520 | |
Zachary Ware | 63f277b | 2014-06-19 09:46:37 -0500 | [diff] [blame] | 521 | os |
| 522 | -- |
| 523 | |
Victor Stinner | 37f2034 | 2015-03-10 13:29:41 +0100 | [diff] [blame] | 524 | * New :func:`os.scandir` function that exposes file information from |
| 525 | the operating system when listing a directory. :func:`os.scandir` |
| 526 | returns an iterator of :class:`os.DirEntry` objects corresponding to |
| 527 | the entries in the directory given by *path*. (Contributed by Ben |
| 528 | Hoyt with the help of Victor Stinner in :issue:`22524`.) |
Victor Stinner | 6036e44 | 2015-03-08 01:58:04 +0100 | [diff] [blame] | 529 | |
Victor Stinner | e1d24f7 | 2014-07-24 12:44:07 +0200 | [diff] [blame] | 530 | * :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] | 531 | attribute on Windows. (Contributed by Ben Hoyt in :issue:`21719`.) |
Zachary Ware | 63f277b | 2014-06-19 09:46:37 -0500 | [diff] [blame] | 532 | |
Serhiy Storchaka | 3822093 | 2015-03-31 15:31:53 +0300 | [diff] [blame] | 533 | os.path |
| 534 | ------- |
| 535 | |
| 536 | * New :func:`~os.path.commonpath` function that extracts common path prefix. |
| 537 | Unlike the :func:`~os.path.commonprefix` function, it always returns a valid |
| 538 | patch. (Contributed by Rafik Draoui and Serhiy Storchaka in :issue:`10395`.) |
| 539 | |
Serhiy Storchaka | 58e4134 | 2015-03-31 14:07:24 +0300 | [diff] [blame] | 540 | pickle |
| 541 | ------ |
| 542 | |
| 543 | * Serializing more "lookupable" objects (such as unbound methods or nested |
| 544 | classes) now are supported with pickle protocols < 4. |
| 545 | (Contributed by Serhiy Storchaka in :issue:`23611`.) |
| 546 | |
R David Murray | b8cd3e4 | 2015-05-16 15:05:53 -0400 | [diff] [blame] | 547 | poplib |
| 548 | ------ |
| 549 | |
| 550 | * A new command :meth:`~poplib.POP3.utf8` enables :rfc:`6856` |
| 551 | (internationalized email) support if the POP server supports it. (Contributed |
| 552 | by Milan OberKirch in :issue:`21804`.) |
| 553 | |
Serhiy Storchaka | 9baa5b2 | 2014-09-29 22:49:23 +0300 | [diff] [blame] | 554 | re |
| 555 | -- |
| 556 | |
| 557 | * Number of capturing groups in regular expression is no longer limited by 100. |
| 558 | (Contributed by Serhiy Storchaka in :issue:`22437`.) |
| 559 | |
Serhiy Storchaka | 7438e4b | 2014-10-10 11:06:31 +0300 | [diff] [blame] | 560 | * Now unmatched groups are replaced with empty strings in :func:`re.sub` |
| 561 | and :func:`re.subn`. (Contributed by Serhiy Storchaka in :issue:`1519638`.) |
| 562 | |
Mark Dickinson | a5d0c7c | 2015-01-11 11:55:29 +0000 | [diff] [blame] | 563 | math |
| 564 | ---- |
| 565 | |
| 566 | * :data:`math.inf` and :data:`math.nan` constants added. (Contributed by Mark |
| 567 | Dickinson in :issue:`23185`.) |
| 568 | |
R David Murray | 6ffface | 2014-06-11 14:40:13 -0400 | [diff] [blame] | 569 | shutil |
| 570 | ------ |
| 571 | |
| 572 | * :func:`~shutil.move` now accepts a *copy_function* argument, allowing, |
| 573 | for example, :func:`~shutil.copy` to be used instead of the default |
| 574 | :func:`~shutil.copy2` if there is a need to ignore metadata. (Contributed by |
| 575 | Claudiu Popa in :issue:`19840`.) |
| 576 | |
Antoine Pitrou | b9d9ce7 | 2014-05-15 22:47:33 +0200 | [diff] [blame] | 577 | signal |
| 578 | ------ |
Brett Cannon | a04dbe4 | 2014-04-04 13:53:38 -0400 | [diff] [blame] | 579 | |
Victor Stinner | bbe3803 | 2015-04-01 16:32:32 +0200 | [diff] [blame] | 580 | * On Windows, :func:`signal.set_wakeup_fd` now also supports socket handles. |
| 581 | (Contributed by Victor Stinner in :issue:`22018`.) |
| 582 | |
Antoine Pitrou | b9d9ce7 | 2014-05-15 22:47:33 +0200 | [diff] [blame] | 583 | * Different constants of :mod:`signal` module are now enumeration values using |
| 584 | the :mod:`enum` module. This allows meaningful names to be printed during |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 585 | debugging, instead of integer “magic numbers”. (Contributed by Giampaolo |
| 586 | Rodola' in :issue:`21076`.) |
R David Murray | 1976d9b | 2014-04-14 20:28:36 -0400 | [diff] [blame] | 587 | |
R David Murray | 554bcbf | 2014-06-11 11:18:08 -0400 | [diff] [blame] | 588 | smtpd |
| 589 | ----- |
| 590 | |
| 591 | * Both :class:`~smtpd.SMTPServer` and :class:`smtpd.SMTPChannel` now accept a |
| 592 | *decode_data* keyword to determine if the DATA portion of the SMTP |
| 593 | transaction is decoded using the ``utf-8`` codec or is instead provided to |
| 594 | :meth:`~smtpd.SMTPServer.process_message` as a byte string. The default |
| 595 | is ``True`` for backward compatibility reasons, but will change to ``False`` |
R David Murray | a33df31 | 2015-05-11 12:11:40 -0400 | [diff] [blame] | 596 | in Python 3.6. If *decode_data* is set to ``False``, the |
| 597 | :meth:`~smtpd.SMTPServer.process_message` method must be prepared to accept |
| 598 | keyword arguments. (Contributed by Maciej Szulik in :issue:`19662`.) |
| 599 | |
| 600 | * :class:`~smtpd.SMTPServer` now advertises the ``8BITMIME`` extension |
| 601 | (:rfc:`6152`) if if *decode_data* has been set ``True``. If the client |
| 602 | specifies ``BODY=8BITMIME`` on the ``MAIL`` command, it is passed to |
| 603 | :meth:`~smtpd.SMTPServer.process_message` via the ``mail_options`` keyword. |
| 604 | (Contributed by Milan Oberkirch and R. David Murray in :issue:`21795`.) |
| 605 | |
| 606 | * :class:`~smtpd.SMTPServer` now supports the ``SMTPUTF8`` extension |
| 607 | (:rfc:`6531`: Internationalized Email). If the client specified ``SMTPUTF8 |
| 608 | BODY=8BITMIME`` on the ``MAIL`` command, they are passed to |
| 609 | :meth:`~smtpd.SMTPServer.process_message` via the ``mail_options`` keyword. |
| 610 | It is the responsibility of the :meth:`~smtpd.SMTPServer.process_message` |
| 611 | method to correctly handle the ``SMTPUTF8`` data. (Contributed by Milan |
| 612 | Oberkirch in :issue:`21725`.) |
R David Murray | 554bcbf | 2014-06-11 11:18:08 -0400 | [diff] [blame] | 613 | |
R David Murray | 6fe56a3 | 2014-06-11 13:48:58 -0400 | [diff] [blame] | 614 | * It is now possible to provide, directly or via name resolution, IPv6 |
| 615 | addresses in the :class:`~smtpd.SMTPServer` constructor, and have it |
| 616 | successfully connect. (Contributed by Milan Oberkirch in :issue:`14758`.) |
| 617 | |
R David Murray | 76e13c1 | 2014-07-03 14:47:46 -0400 | [diff] [blame] | 618 | smtplib |
| 619 | ------- |
| 620 | |
| 621 | * A new :meth:`~smtplib.SMTP.auth` method provides a convenient way to |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 622 | implement custom authentication mechanisms. |
| 623 | (Contributed by Milan Oberkirch in :issue:`15014`.) |
R David Murray | 76e13c1 | 2014-07-03 14:47:46 -0400 | [diff] [blame] | 624 | |
R David Murray | 0c49b89 | 2015-04-16 17:14:42 -0400 | [diff] [blame] | 625 | * Additional debuglevel (2) shows timestamps for debug messages in |
| 626 | :class:`smtplib.SMTP`. (Contributed by Gavin Chappell and Maciej Szulik in |
| 627 | :issue:`16914`.) |
| 628 | |
R David Murray | 8308444 | 2015-05-17 19:27:22 -0400 | [diff] [blame] | 629 | * :mod:`smtplib` now supports :rfc:`6531` (SMTPUTF8) in both the |
| 630 | :meth:`~smtplib.SMTP.sendmail` and :meth:`~smtplib.SMTP.send_message` |
| 631 | commands. (Contributed by Milan Oberkirch and R. David Murray in |
| 632 | :issue:`22027`.) |
R David Murray | cee7cf6 | 2015-05-16 13:58:14 -0400 | [diff] [blame] | 633 | |
R David Murray | 4487dd0 | 2014-10-09 16:59:30 -0400 | [diff] [blame] | 634 | sndhdr |
| 635 | ------ |
| 636 | |
| 637 | * :func:`~sndhdr.what` and :func:`~sndhdr.whathdr` now return |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 638 | :func:`~collections.namedtuple`. |
| 639 | (Contributed by Claudiu Popa in :issue:`18615`.) |
R David Murray | 4487dd0 | 2014-10-09 16:59:30 -0400 | [diff] [blame] | 640 | |
Giampaolo Rodola' | 915d141 | 2014-06-11 03:54:30 +0200 | [diff] [blame] | 641 | socket |
| 642 | ------ |
| 643 | |
| 644 | * New :meth:`socket.socket.sendfile` method allows to send a file over a socket |
| 645 | by using high-performance :func:`os.sendfile` function on UNIX resulting in |
| 646 | uploads being from 2x to 3x faster than when using plain |
| 647 | :meth:`socket.socket.send`. |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 648 | (Contributed by Giampaolo Rodola' in :issue:`17552`.) |
Giampaolo Rodola' | 915d141 | 2014-06-11 03:54:30 +0200 | [diff] [blame] | 649 | |
Gregory P. Smith | 6e73000 | 2015-04-14 16:14:25 -0700 | [diff] [blame] | 650 | subprocess |
| 651 | ---------- |
| 652 | |
| 653 | * The new :func:`subprocess.run` function runs subprocesses and returns a |
| 654 | :class:`subprocess.CompletedProcess` object. It Provides a more consistent |
| 655 | API than :func:`~subprocess.call`, :func:`~subprocess.check_call` and |
| 656 | :func:`~subprocess.check_output`. |
| 657 | |
Eric V. Smith | 7a80389 | 2015-04-15 10:27:58 -0400 | [diff] [blame] | 658 | sysconfig |
| 659 | --------- |
| 660 | |
| 661 | * The user scripts directory on Windows is now versioned. |
| 662 | (Contributed by Paul Moore in :issue:`23437`.) |
| 663 | |
| 664 | tarfile |
| 665 | ------- |
| 666 | |
| 667 | * The :func:`tarfile.open` function now supports ``'x'`` (exclusive creation) |
| 668 | mode. (Contributed by Berker Peksag in :issue:`21717`.) |
| 669 | |
| 670 | * The :meth:`~tarfile.TarFile.extractall` and :meth:`~tarfile.TarFile.extract` |
| 671 | methods now take a keyword parameter *numeric_only*. If set to ``True``, |
| 672 | the extracted files and directories will be owned by the numeric uid and gid |
| 673 | from the tarfile. If set to ``False`` (the default, and the behavior in |
| 674 | versions prior to 3.5), they will be owned bythe named user and group in the |
| 675 | tarfile. (Contributed by Michael Vogt and Eric Smith in :issue:`23193`.) |
| 676 | |
Victor Stinner | ae58649 | 2014-09-02 23:18:25 +0200 | [diff] [blame] | 677 | time |
| 678 | ---- |
| 679 | |
Berker Peksag | 882c95c | 2014-10-09 11:46:56 +0300 | [diff] [blame] | 680 | * The :func:`time.monotonic` function is now always available. (Contributed by |
| 681 | Victor Stinner in :issue:`22043`.) |
Victor Stinner | ae58649 | 2014-09-02 23:18:25 +0200 | [diff] [blame] | 682 | |
Zachary Ware | 7dc9dea | 2015-05-22 11:36:53 -0500 | [diff] [blame] | 683 | tkinter |
| 684 | ------- |
| 685 | |
Nick Coghlan | d5cacbb | 2015-05-23 22:24:10 +1000 | [diff] [blame^] | 686 | * The :mod:`tkinter._fix` module used for setting up the Tcl/Tk environment |
Zachary Ware | 7dc9dea | 2015-05-22 11:36:53 -0500 | [diff] [blame] | 687 | on Windows has been replaced by a private function in the :module:`_tkinter` |
| 688 | module which makes no permanent changes to environment variables. |
| 689 | (Contributed by Zachary Ware in :issue:`20035`.) |
| 690 | |
Yury Selivanov | f3e40fa | 2015-05-21 11:50:30 -0400 | [diff] [blame] | 691 | types |
| 692 | ----- |
| 693 | |
| 694 | * New :func:`~types.coroutine` function. (Contributed by Yury Selivanov |
| 695 | in :issue:`24017`.) |
| 696 | |
Berker Peksag | bd09d7b | 2015-02-11 15:32:34 +0200 | [diff] [blame] | 697 | urllib |
| 698 | ------ |
Nick Coghlan | c216c48 | 2014-11-12 23:33:50 +1000 | [diff] [blame] | 699 | |
R David Murray | 4c7f995 | 2015-04-16 16:36:18 -0400 | [diff] [blame] | 700 | * A new :class:`~urllib.request.HTTPPasswordMgrWithPriorAuth` allows HTTP Basic |
| 701 | Authentication credentials to be managed so as to eliminate unnecessary |
| 702 | ``401`` response handling, or to unconditionally send credentials |
| 703 | on the first request in order to communicate with servers that return a |
| 704 | ``404`` response instead of a ``401`` if the ``Authorization`` header is not |
| 705 | sent. (Contributed by Matej Cepl in :issue:`19494` and Akshit Khurana in |
| 706 | :issue:`7159`.) |
Nick Coghlan | c216c48 | 2014-11-12 23:33:50 +1000 | [diff] [blame] | 707 | |
R David Murray | c17686f | 2015-05-17 20:44:50 -0400 | [diff] [blame] | 708 | * A new :func:`~urllib.parse.urlencode` parameter *quote_via* provides a way to |
| 709 | control the encoding of query parts if needed. (Contributed by Samwyse and |
| 710 | Arnon Yaari in :issue:`13866`.) |
| 711 | |
Berker Peksag | 3e88722 | 2014-07-02 08:37:22 +0300 | [diff] [blame] | 712 | wsgiref |
| 713 | ------- |
| 714 | |
| 715 | * *headers* parameter of :class:`wsgiref.headers.Headers` is now optional. |
| 716 | (Contributed by Pablo Torres Navarrete and SilentGhost in :issue:`5800`.) |
| 717 | |
Antoine Pitrou | b9d9ce7 | 2014-05-15 22:47:33 +0200 | [diff] [blame] | 718 | xmlrpc |
| 719 | ------ |
| 720 | |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 721 | * :class:`xmlrpc.client.ServerProxy` is now a :term:`context manager`. |
| 722 | (Contributed by Claudiu Popa in :issue:`20627`.) |
Brett Cannon | 6eaac13 | 2014-05-09 12:28:22 -0400 | [diff] [blame] | 723 | |
Serhiy Storchaka | 61de087 | 2015-04-02 21:00:13 +0300 | [diff] [blame] | 724 | xml.sax |
| 725 | ------- |
| 726 | |
| 727 | * SAX parsers now support a character stream of |
| 728 | :class:`~xml.sax.xmlreader.InputSource` object. |
| 729 | (Contributed by Serhiy Storchaka in :issue:`2175`.) |
| 730 | |
Victor Stinner | 95bb714 | 2015-03-12 15:32:03 +0100 | [diff] [blame] | 731 | faulthandler |
| 732 | ------------ |
| 733 | |
| 734 | * :func:`~faulthandler.enable`, :func:`~faulthandler.register`, |
| 735 | :func:`~faulthandler.dump_traceback` and |
| 736 | :func:`~faulthandler.dump_traceback_later` functions now accept file |
| 737 | descriptors. (Contributed by Wei Wu in :issue:`23566`.) |
| 738 | |
Serhiy Storchaka | 77d8997 | 2015-03-23 01:09:35 +0200 | [diff] [blame] | 739 | zipfile |
| 740 | ------- |
| 741 | |
| 742 | * Added support for writing ZIP files to unseekable streams. |
| 743 | (Contributed by Serhiy Storchaka in :issue:`23252`.) |
| 744 | |
Serhiy Storchaka | 764fc9b | 2015-03-25 10:09:41 +0200 | [diff] [blame] | 745 | * The :func:`zipfile.ZipFile.open` function now supports ``'x'`` (exclusive |
| 746 | creation) mode. (Contributed by Serhiy Storchaka in :issue:`21717`.) |
| 747 | |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 748 | |
| 749 | Optimizations |
| 750 | ============= |
| 751 | |
Antoine Pitrou | b9d9ce7 | 2014-05-15 22:47:33 +0200 | [diff] [blame] | 752 | The following performance enhancements have been added: |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 753 | |
Victor Stinner | 37f2034 | 2015-03-10 13:29:41 +0100 | [diff] [blame] | 754 | * :func:`os.walk` has been sped up by 3-5x on POSIX systems and 7-20x |
| 755 | on Windows. This was done using the new :func:`os.scandir` function, |
| 756 | which exposes file information from the underlying ``readdir`` and |
| 757 | ``FindFirstFile``/``FindNextFile`` system calls. (Contributed by |
| 758 | Ben Hoyt with help from Victor Stinner in :issue:`23605`.) |
| 759 | |
Brett Cannon | f299abd | 2015-04-13 14:21:02 -0400 | [diff] [blame] | 760 | * 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] | 761 | memory for large objects. ``calloc()`` is used instead of ``malloc()`` to |
Victor Stinner | db067af | 2014-05-02 22:31:14 +0200 | [diff] [blame] | 762 | allocate memory for these objects. |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 763 | |
Antoine Pitrou | 0dfce56 | 2014-05-15 22:55:40 +0200 | [diff] [blame] | 764 | * Some operations on :class:`~ipaddress.IPv4Network` and |
| 765 | :class:`~ipaddress.IPv6Network` have been massively sped up, such as |
| 766 | :meth:`~ipaddress.IPv4Network.subnets`, :meth:`~ipaddress.IPv4Network.supernet`, |
| 767 | :func:`~ipaddress.summarize_address_range`, :func:`~ipaddress.collapse_addresses`. |
| 768 | The speed up can range from 3x to 15x. |
| 769 | (:issue:`21486`, :issue:`21487`, :issue:`20826`) |
| 770 | |
Serhiy Storchaka | 87d0b45 | 2015-02-03 11:30:10 +0200 | [diff] [blame] | 771 | * Many operations on :class:`io.BytesIO` are now 50% to 100% faster. |
Berker Peksag | 9121fe8 | 2015-02-15 00:45:57 +0200 | [diff] [blame] | 772 | (Contributed by Serhiy Storchaka in :issue:`15381` and David Wilson in |
| 773 | :issue:`22003`.) |
Serhiy Storchaka | 87d0b45 | 2015-02-03 11:30:10 +0200 | [diff] [blame] | 774 | |
Serhiy Storchaka | c1efe5f | 2015-02-11 15:54:54 +0200 | [diff] [blame] | 775 | * :func:`marshal.dumps` is now faster (65%-85% with versions 3--4, 20-25% with |
| 776 | versions 0--2 on typical data, and up to 5x in best cases). |
| 777 | (Contributed by Serhiy Storchaka in :issue:`20416` and :issue:`23344`.) |
Serhiy Storchaka | ce921c62 | 2015-02-11 15:53:31 +0200 | [diff] [blame] | 778 | |
Serhiy Storchaka | 0d4df75 | 2015-05-12 23:12:45 +0300 | [diff] [blame] | 779 | * The UTF-32 encoder is now 3x to 7x faster. (Contributed by Serhiy Storchaka |
| 780 | in :issue:`15027`.) |
| 781 | |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 782 | |
| 783 | Build and C API Changes |
| 784 | ======================= |
| 785 | |
| 786 | Changes to Python's build process and to the C API include: |
| 787 | |
Victor Stinner | db067af | 2014-05-02 22:31:14 +0200 | [diff] [blame] | 788 | * New ``calloc`` functions: |
| 789 | |
| 790 | * :c:func:`PyMem_RawCalloc` |
| 791 | * :c:func:`PyMem_Calloc` |
| 792 | * :c:func:`PyObject_Calloc` |
| 793 | * :c:func:`_PyObject_GC_Calloc` |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 794 | |
| 795 | |
| 796 | Deprecated |
| 797 | ========== |
| 798 | |
| 799 | Unsupported Operating Systems |
| 800 | ----------------------------- |
| 801 | |
Zachary Ware | 38019d1 | 2015-04-13 15:51:59 -0500 | [diff] [blame] | 802 | * Windows XP - Per :PEP:`11`, Microsoft support of Windows XP has ended. |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 803 | |
| 804 | |
| 805 | Deprecated Python modules, functions and methods |
| 806 | ------------------------------------------------ |
| 807 | |
Brett Cannon | a77d0c3 | 2014-03-21 10:52:33 -0400 | [diff] [blame] | 808 | * The :mod:`formatter` module has now graduated to full deprecation and is still |
| 809 | slated for removal in Python 3.6. |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 810 | |
R David Murray | 554bcbf | 2014-06-11 11:18:08 -0400 | [diff] [blame] | 811 | * :mod:`smtpd` has in the past always decoded the DATA portion of email |
| 812 | messages using the ``utf-8`` codec. This can now be controlled by the new |
| 813 | *decode_data* keyword to :class:`~smtpd.SMTPServer`. The default value is |
| 814 | ``True``, but this default is deprecated. Specify the *decode_data* keyword |
| 815 | with an appropriate value to avoid the deprecation warning. |
| 816 | |
R David Murray | 1813c17 | 2015-03-29 17:09:21 -0400 | [diff] [blame] | 817 | * Directly assigning values to the :attr:`~http.cookies.Morsel.key`, |
| 818 | :attr:`~http.cookies.Morsel.value` and |
| 819 | :attr:`~http.cookies.Morsel.coded_value` of :class:`~http.cookies.Morsel` |
| 820 | objects is deprecated. Use the :func:`~http.cookies.Morsel.set` method |
| 821 | instead. In addition, the undocumented *LegalChars* parameter of |
| 822 | :func:`~http.cookies.Morsel.set` is deprecated, and is now ignored. |
Serhiy Storchaka | 9c1a9b2 | 2015-03-18 10:59:57 +0200 | [diff] [blame] | 823 | |
Serhiy Storchaka | b876df4 | 2015-03-24 22:30:46 +0200 | [diff] [blame] | 824 | * Passing a format string as keyword argument *format_string* to the |
| 825 | :meth:`~string.Formatter.format` method of the :class:`string.Formatter` |
| 826 | class has been deprecated. |
| 827 | |
Berker Peksag | 2f3742b | 2015-05-13 12:32:20 +0300 | [diff] [blame] | 828 | * :func:`platform.dist` and :func:`platform.linux_distribution` functions are |
| 829 | now deprecated and will be removed in Python 3.7. Linux distributions use |
| 830 | too many different ways of describing themselves, so the functionality is |
| 831 | left to a package. |
| 832 | (Contributed by Vajrasky Kok and Berker Peksag in :issue:`1322`.) |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 833 | |
Benjamin Peterson | b1cc37c | 2015-05-20 22:09:43 -0500 | [diff] [blame] | 834 | * The previously undocumented ``from_function`` and ``from_builtin`` methods of |
| 835 | :class:`inspect.Signature` are deprecated. Use new |
Yury Selivanov | 57c74fc | 2015-05-20 23:07:02 -0400 | [diff] [blame] | 836 | :meth:`inspect.Signature.from_callable` instead. (Contributed by Yury |
| 837 | Selivanov in :issue:`24248`.) |
| 838 | |
Yury Selivanov | 945fff4 | 2015-05-22 16:28:05 -0400 | [diff] [blame] | 839 | * :func:`inspect.getargspec` is deprecated and scheduled to be removed in |
| 840 | Python 3.6. (See :issue:`20438` for details.) |
| 841 | |
| 842 | * :func:`~inspect.getfullargspec`, :func:`~inspect.getargvalues`, |
| 843 | :func:`~inspect.getcallargs`, :func:`~inspect.getargvalues`, |
| 844 | :func:`~inspect.formatargspec`, and :func:`~inspect.formatargvalues` are |
| 845 | deprecated in favor of :func:`inspect.signature` API. (See :issue:`20438` |
| 846 | for details.) |
| 847 | |
| 848 | |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 849 | Deprecated functions and types of the C API |
| 850 | ------------------------------------------- |
| 851 | |
| 852 | * None yet. |
| 853 | |
| 854 | |
| 855 | Deprecated features |
| 856 | ------------------- |
| 857 | |
| 858 | * None yet. |
| 859 | |
| 860 | |
R David Murray | df75fee | 2014-10-03 13:02:47 -0400 | [diff] [blame] | 861 | Removed |
| 862 | ======= |
| 863 | |
Berker Peksag | 8f791d3 | 2014-11-01 10:45:57 +0200 | [diff] [blame] | 864 | API and Feature Removals |
| 865 | ------------------------ |
| 866 | |
| 867 | The following obsolete and previously deprecated APIs and features have been |
| 868 | removed: |
| 869 | |
R David Murray | df75fee | 2014-10-03 13:02:47 -0400 | [diff] [blame] | 870 | * The ``__version__`` attribute has been dropped from the email package. The |
| 871 | email code hasn't been shipped separately from the stdlib for a long time, |
| 872 | and the ``__version__`` string was not updated in the last few releases. |
| 873 | |
Berker Peksag | 8f791d3 | 2014-11-01 10:45:57 +0200 | [diff] [blame] | 874 | * The internal ``Netrc`` class in the :mod:`ftplib` module was deprecated in |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 875 | 3.4, and has now been removed. |
| 876 | (Contributed by Matt Chaput in :issue:`6623`.) |
R David Murray | df75fee | 2014-10-03 13:02:47 -0400 | [diff] [blame] | 877 | |
Brett Cannon | f299abd | 2015-04-13 14:21:02 -0400 | [diff] [blame] | 878 | * The concept of ``.pyo`` files has been removed. |
| 879 | |
R David Murray | e81a773 | 2015-04-12 18:47:56 -0400 | [diff] [blame] | 880 | * The JoinableQueue class in the provisional asyncio module was deprecated |
| 881 | in 3.4.4 and is now removed (:issue:`23464`). |
| 882 | |
| 883 | |
Victor Stinner | 01adf06 | 2014-03-18 00:53:32 +0100 | [diff] [blame] | 884 | Porting to Python 3.5 |
| 885 | ===================== |
| 886 | |
| 887 | This section lists previously described changes and other bugfixes |
| 888 | that may require changes to your code. |
| 889 | |
Victor Stinner | db067af | 2014-05-02 22:31:14 +0200 | [diff] [blame] | 890 | Changes in the Python API |
| 891 | ------------------------- |
| 892 | |
Victor Stinner | f70e1ca | 2015-03-30 21:16:11 +0200 | [diff] [blame] | 893 | * :pep:`475`: Examples of functions which are now retried when interrupted |
| 894 | instead of raising :exc:`InterruptedError` if the signal handler does not |
| 895 | raise an exception: |
Victor Stinner | a766ddf | 2015-03-26 23:50:57 +0100 | [diff] [blame] | 896 | |
Victor Stinner | 45ca48b | 2015-03-31 12:10:33 +0200 | [diff] [blame] | 897 | - :func:`open`, :func:`os.open`, :func:`io.open` |
Victor Stinner | acd8e7c | 2015-04-02 13:56:29 +0200 | [diff] [blame] | 898 | - functions of the :mod:`faulthandler` module |
| 899 | - :mod:`os` functions: |
| 900 | |
| 901 | * :func:`os.fchdir` |
| 902 | * :func:`os.fchmod` |
| 903 | * :func:`os.fchown` |
| 904 | * :func:`os.fdatasync` |
| 905 | * :func:`os.fstat` |
| 906 | * :func:`os.fstatvfs` |
| 907 | * :func:`os.fsync` |
| 908 | * :func:`os.ftruncate` |
| 909 | * :func:`os.mkfifo` |
| 910 | * :func:`os.mknod` |
| 911 | * :func:`os.posix_fadvise` |
| 912 | * :func:`os.posix_fallocate` |
| 913 | * :func:`os.pread` |
| 914 | * :func:`os.pwrite` |
| 915 | * :func:`os.read` |
| 916 | * :func:`os.readv` |
| 917 | * :func:`os.sendfile` |
| 918 | * :func:`os.wait3` |
| 919 | * :func:`os.wait4` |
| 920 | * :func:`os.wait` |
| 921 | * :func:`os.waitid` |
| 922 | * :func:`os.waitpid` |
| 923 | * :func:`os.write` |
| 924 | * :func:`os.writev` |
| 925 | * special cases: :func:`os.close` and :func:`os.dup2` now ignore |
| 926 | :py:data:`~errno.EINTR` error, the syscall is not retried (see the PEP |
| 927 | for the rationale) |
| 928 | |
Victor Stinner | 4448c08 | 2015-03-31 11:48:34 +0200 | [diff] [blame] | 929 | - :func:`select.select`, :func:`select.poll.poll`, :func:`select.epoll.poll`, |
Victor Stinner | 45ca48b | 2015-03-31 12:10:33 +0200 | [diff] [blame] | 930 | :func:`select.kqueue.control`, :func:`select.devpoll.poll` |
Victor Stinner | 708d9ba | 2015-04-02 11:49:42 +0200 | [diff] [blame] | 931 | - :func:`socket.socket` methods: |
| 932 | |
| 933 | * :meth:`~socket.socket.accept` |
Victor Stinner | 81c41db | 2015-04-02 11:50:57 +0200 | [diff] [blame] | 934 | * :meth:`~socket.socket.connect` (except for non-blocking sockets) |
Victor Stinner | 708d9ba | 2015-04-02 11:49:42 +0200 | [diff] [blame] | 935 | * :meth:`~socket.socket.recv` |
| 936 | * :meth:`~socket.socket.recvfrom` |
| 937 | * :meth:`~socket.socket.recvmsg` |
| 938 | * :meth:`~socket.socket.send` |
| 939 | * :meth:`~socket.socket.sendall` |
| 940 | * :meth:`~socket.socket.sendmsg` |
| 941 | * :meth:`~socket.socket.sendto` |
| 942 | |
Victor Stinner | eb011cb | 2015-03-31 12:19:15 +0200 | [diff] [blame] | 943 | - :func:`signal.sigtimedwait`, :func:`signal.sigwaitinfo` |
Victor Stinner | a766ddf | 2015-03-26 23:50:57 +0100 | [diff] [blame] | 944 | - :func:`time.sleep` |
| 945 | |
Benjamin Peterson | ee6bdc0 | 2014-03-20 18:00:35 -0500 | [diff] [blame] | 946 | * Before Python 3.5, a :class:`datetime.time` object was considered to be false |
| 947 | if it represented midnight in UTC. This behavior was considered obscure and |
| 948 | error-prone and has been removed in Python 3.5. See :issue:`13936` for full |
| 949 | details. |
Antoine Pitrou | 92c4d45 | 2014-04-29 10:05:59 +0200 | [diff] [blame] | 950 | |
| 951 | * :meth:`ssl.SSLSocket.send()` now raises either :exc:`ssl.SSLWantReadError` |
| 952 | or :exc:`ssl.SSLWantWriteError` on a non-blocking socket if the operation |
| 953 | would block. Previously, it would return 0. See :issue:`20951`. |
Victor Stinner | db067af | 2014-05-02 22:31:14 +0200 | [diff] [blame] | 954 | |
Victor Stinner | 40ee301 | 2014-06-16 15:59:28 +0200 | [diff] [blame] | 955 | * The ``__name__`` attribute of generator is now set from the function name, |
| 956 | instead of being set from the code name. Use ``gen.gi_code.co_name`` to |
| 957 | retrieve the code name. Generators also have a new ``__qualname__`` |
| 958 | attribute, the qualified name, which is now used for the representation |
| 959 | of a generator (``repr(gen)``). See :issue:`21205`. |
| 960 | |
Ezio Melotti | 045160b | 2014-08-02 18:54:30 +0300 | [diff] [blame] | 961 | * The deprecated "strict" mode and argument of :class:`~html.parser.HTMLParser`, |
| 962 | :meth:`HTMLParser.error`, and the :exc:`HTMLParserError` exception have been |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 963 | removed. (Contributed by Ezio Melotti in :issue:`15114`.) |
Ezio Melotti | 045160b | 2014-08-02 18:54:30 +0300 | [diff] [blame] | 964 | The *convert_charrefs* argument of :class:`~html.parser.HTMLParser` is |
Serhiy Storchaka | c1ded29 | 2014-11-02 19:22:02 +0200 | [diff] [blame] | 965 | now ``True`` by default. (Contributed by Berker Peksag in :issue:`21047`.) |
Ezio Melotti | 045160b | 2014-08-02 18:54:30 +0300 | [diff] [blame] | 966 | |
R David Murray | 861470c | 2014-10-05 11:47:01 -0400 | [diff] [blame] | 967 | * Although it is not formally part of the API, it is worth noting for porting |
| 968 | purposes (ie: fixing tests) that error messages that were previously of the |
| 969 | 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] | 970 | bytes-like object is required, not 'sometype'". (Contributed by Ezio Melotti |
| 971 | in :issue:`16518`.) |
R David Murray | 861470c | 2014-10-05 11:47:01 -0400 | [diff] [blame] | 972 | |
Brett Cannon | b6e2556 | 2014-11-21 12:19:28 -0500 | [diff] [blame] | 973 | * If the current directory is set to a directory that no longer exists then |
| 974 | :exc:`FileNotFoundError` will no longer be raised and instead |
| 975 | :meth:`~importlib.machinery.FileFinder.find_spec` will return ``None`` |
| 976 | **without** caching ``None`` in :data:`sys.path_importer_cache` which is |
| 977 | different than the typical case (:issue:`22834`). |
| 978 | |
Berker Peksag | 088ca8b | 2015-02-06 10:17:49 +0200 | [diff] [blame] | 979 | * HTTP status code and messages from :mod:`http.client` and :mod:`http.server` |
| 980 | were refactored into a common :class:`~http.HTTPStatus` enum. The values in |
| 981 | :mod:`http.client` and :mod:`http.server` remain available for backwards |
| 982 | compatibility. (Contributed by Demian Brecht in :issue:`21793`.) |
Serhiy Storchaka | e4db769 | 2014-12-23 16:28:28 +0200 | [diff] [blame] | 983 | |
Brett Cannon | 02d8454 | 2015-01-09 11:39:21 -0500 | [diff] [blame] | 984 | * When an import loader defines :meth:`~importlib.machinery.Loader.exec_module` |
| 985 | it is now expected to also define |
| 986 | :meth:`~importlib.machinery.Loader.create_module` (raises a |
| 987 | :exc:`DeprecationWarning` now, will be an error in Python 3.6). If the loader |
| 988 | inherits from :class:`importlib.abc.Loader` then there is nothing to do, else |
| 989 | simply define :meth:`~importlib.machinery.Loader.create_module` to return |
| 990 | ``None`` (:issue:`23014`). |
| 991 | |
Serhiy Storchaka | 83e8027 | 2015-02-03 11:04:19 +0200 | [diff] [blame] | 992 | * :func:`re.split` always ignored empty pattern matches, so the ``'x*'`` |
| 993 | pattern worked the same as ``'x+'``, and the ``'\b'`` pattern never worked. |
| 994 | Now :func:`re.split` raises a warning if the pattern could match |
| 995 | an empty string. For compatibility use patterns that never match an empty |
| 996 | string (e.g. ``'x+'`` instead of ``'x*'``). Patterns that could only match |
| 997 | an empty string (such as ``'\b'``) now raise an error. |
| 998 | |
R David Murray | 1813c17 | 2015-03-29 17:09:21 -0400 | [diff] [blame] | 999 | * The :class:`~http.cookies.Morsel` dict-like interface has been made self |
| 1000 | consistent: morsel comparison now takes the :attr:`~http.cookies.Morsel.key` |
| 1001 | and :attr:`~http.cookies.Morsel.value` into account, |
| 1002 | :meth:`~http.cookies.Morsel.copy` now results in a |
R David Murray | ba6ea9b | 2015-03-30 11:48:50 -0400 | [diff] [blame] | 1003 | :class:`~http.cookies.Morsel` instance rather than a :class:`dict`, and |
| 1004 | :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] | 1005 | keys in the update dictionary are invalid. In addition, the undocumented |
| 1006 | *LegalChars* parameter of :func:`~http.cookies.Morsel.set` is deprecated and |
| 1007 | is now ignored. (:issue:`2211`) |
| 1008 | |
Brett Cannon | f299abd | 2015-04-13 14:21:02 -0400 | [diff] [blame] | 1009 | * :pep:`488` has removed ``.pyo`` files from Python and introduced the optional |
| 1010 | ``opt-`` tag in ``.pyc`` file names. The |
| 1011 | :func:`importlib.util.cache_from_source` has gained an *optimization* |
| 1012 | parameter to help control the ``opt-`` tag. Because of this, the |
| 1013 | *debug_override* parameter of the function is now deprecated. `.pyo` files |
| 1014 | are also no longer supported as a file argument to the Python interpreter and |
| 1015 | thus serve no purpose when distributed on their own (i.e. sourcless code |
| 1016 | distribution). Due to the fact that the magic number for bytecode has changed |
| 1017 | in Python 3.5, all old `.pyo` files from previous versions of Python are |
| 1018 | invalid regardless of this PEP. |
| 1019 | |
Larry Hastings | a6cc551 | 2015-04-13 17:48:40 -0400 | [diff] [blame] | 1020 | * The :mod:`socket` module now exports the CAN_RAW_FD_FRAMES constant on linux |
| 1021 | 3.6 and greater. |
| 1022 | |
R David Murray | 2b78129 | 2015-04-16 12:15:09 -0400 | [diff] [blame] | 1023 | * The `pygettext.py` Tool now uses the standard +NNNN format for timezones in |
| 1024 | the POT-Creation-Date header. |
| 1025 | |
R David Murray | 0c49b89 | 2015-04-16 17:14:42 -0400 | [diff] [blame] | 1026 | * The :mod:`smtplib` module now uses :data:`sys.stderr` instead of previous |
| 1027 | module level :data:`stderr` variable for debug output. If your (test) |
| 1028 | program depends on patching the module level variable to capture the debug |
| 1029 | output, you will need to update it to capture sys.stderr instead. |
| 1030 | |
Victor Stinner | db067af | 2014-05-02 22:31:14 +0200 | [diff] [blame] | 1031 | Changes in the C API |
| 1032 | -------------------- |
| 1033 | |
Stefan Krah | f5324d7 | 2015-01-29 14:29:51 +0100 | [diff] [blame] | 1034 | * The undocumented :c:member:`~PyMemoryViewObject.format` member of the |
| 1035 | (non-public) :c:type:`PyMemoryViewObject` structure has been removed. |
| 1036 | |
| 1037 | All extensions relying on the relevant parts in ``memoryobject.h`` |
| 1038 | must be rebuilt. |
| 1039 | |
Victor Stinner | d8f0d92 | 2014-06-02 21:57:10 +0200 | [diff] [blame] | 1040 | * The :c:type:`PyMemAllocator` structure was renamed to |
| 1041 | :c:type:`PyMemAllocatorEx` and a new ``calloc`` field was added. |
Serhiy Storchaka | df4518c | 2014-11-18 23:34:33 +0200 | [diff] [blame] | 1042 | |
| 1043 | * Removed non-documented macro :c:macro:`PyObject_REPR` which leaked references. |
| 1044 | Use format character ``%R`` in :c:func:`PyUnicode_FromFormat`-like functions |
| 1045 | to format the :func:`repr` of the object. |
Serhiy Storchaka | 490055a | 2015-03-01 10:03:02 +0200 | [diff] [blame] | 1046 | |
| 1047 | * Because the lack of the :attr:`__module__` attribute breaks pickling and |
| 1048 | introspection, a deprecation warning now is raised for builtin type without |
| 1049 | the :attr:`__module__` attribute. Would be an AttributeError in future. |
| 1050 | (:issue:`20204`) |
Yury Selivanov | 5096088 | 2015-05-12 00:15:05 -0400 | [diff] [blame] | 1051 | |
| 1052 | * As part of PEP 492 implementation, ``tp_reserved`` slot of |
Yury Selivanov | f3e40fa | 2015-05-21 11:50:30 -0400 | [diff] [blame] | 1053 | :c:type:`PyTypeObject` was replaced with a |
| 1054 | :c:member:`PyTypeObject.tp_as_async` slot. |