Ned Deily | 4829bc6 | 2016-09-12 17:29:04 -0400 | [diff] [blame] | 1 | **************************** |
| 2 | What's New In Python 3.7 |
| 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.7, compared to 3.6. |
| 49 | |
Steve Dower | 3e7d93d | 2016-09-22 17:11:53 -0700 | [diff] [blame] | 50 | For full details, see the :ref:`changelog <changelog>`. |
Ned Deily | 4829bc6 | 2016-09-12 17:29:04 -0400 | [diff] [blame] | 51 | |
| 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.7 moves towards release, |
| 56 | so it's worth checking back even after reading earlier versions. |
| 57 | |
| 58 | |
| 59 | Summary -- Release highlights |
| 60 | ============================= |
| 61 | |
| 62 | .. This section singles out the most important changes in Python 3.7. |
| 63 | Brevity is key. |
| 64 | |
| 65 | |
| 66 | .. PEP-sized items next. |
| 67 | |
| 68 | |
| 69 | |
| 70 | New Features |
| 71 | ============ |
| 72 | |
Nick Coghlan | 6ea4186 | 2017-06-11 13:16:15 +1000 | [diff] [blame] | 73 | .. _whatsnew37-pep538: |
| 74 | |
| 75 | PEP 538: Legacy C Locale Coercion |
| 76 | --------------------------------- |
| 77 | |
| 78 | An ongoing challenge within the Python 3 series has been determining a sensible |
| 79 | default strategy for handling the "7-bit ASCII" text encoding assumption |
| 80 | currently implied by the use of the default C locale on non-Windows platforms. |
| 81 | |
| 82 | :pep:`538` updates the default interpreter command line interface to |
| 83 | automatically coerce that locale to an available UTF-8 based locale as |
| 84 | described in the documentation of the new :envvar:`PYTHONCOERCECLOCALE` |
| 85 | environment variable. Automatically setting ``LC_CTYPE`` this way means that |
| 86 | both the core interpreter and locale-aware C extensions (such as |
| 87 | :mod:`readline`) will assume the use of UTF-8 as the default text encoding, |
| 88 | rather than ASCII. |
| 89 | |
| 90 | The platform support definition in :pep:`11` has also been updated to limit |
| 91 | full text handling support to suitably configured non-ASCII based locales. |
| 92 | |
| 93 | As part of this change, the default error handler for ``stdin`` and ``stdout`` |
| 94 | is now ``surrogateescape`` (rather than ``strict``) when using any of the |
| 95 | defined coercion target locales (currently ``C.UTF-8``, ``C.utf8``, and |
| 96 | ``UTF-8``). The default error handler for ``stderr`` continues to be |
| 97 | ``backslashreplace``, regardless of locale. |
| 98 | |
Nick Coghlan | eb81795 | 2017-06-18 12:29:42 +1000 | [diff] [blame] | 99 | Locale coercion is silent by default, but to assist in debugging potentially |
| 100 | locale related integration problems, explicit warnings (emitted directly on |
| 101 | ``stderr`` can be requested by setting ``PYTHONCOERCECLOCALE=warn``. This |
| 102 | setting will also cause the Python runtime to emit a warning if the legacy C |
| 103 | locale remains active when the core interpreter is initialized. |
Nick Coghlan | 6ea4186 | 2017-06-11 13:16:15 +1000 | [diff] [blame] | 104 | |
| 105 | .. seealso:: |
| 106 | |
| 107 | :pep:`538` -- Coercing the legacy C locale to a UTF-8 based locale |
| 108 | PEP written and implemented by Nick Coghlan. |
Ned Deily | 4829bc6 | 2016-09-12 17:29:04 -0400 | [diff] [blame] | 109 | |
Barry Warsaw | 36c1d1f | 2017-10-05 12:11:18 -0400 | [diff] [blame] | 110 | .. _whatsnew37-pep553: |
| 111 | |
| 112 | PEP 553: Built-in breakpoint() |
| 113 | ------------------------------ |
| 114 | |
| 115 | :pep:`553` describes a new built-in called ``breakpoint()`` which makes it |
| 116 | easy and consistent to enter the Python debugger. Built-in ``breakpoint()`` |
| 117 | calls ``sys.breakpointhook()``. By default, this latter imports ``pdb`` and |
| 118 | then calls ``pdb.set_trace()``, but by binding ``sys.breakpointhook()`` to the |
| 119 | function of your choosing, ``breakpoint()`` can enter any debugger. Or, the |
| 120 | environment variable :envvar:`PYTHONBREAKPOINT` can be set to the callable of |
| 121 | your debugger of choice. Set ``PYTHONBREAKPOINT=0`` to completely disable |
| 122 | built-in ``breakpoint()``. |
| 123 | |
| 124 | .. seealso:: |
| 125 | |
| 126 | :pep:`553` -- Built-in breakpoint() |
| 127 | PEP written and implemented by Barry Warsaw |
| 128 | |
Ned Deily | 4829bc6 | 2016-09-12 17:29:04 -0400 | [diff] [blame] | 129 | |
Masayuki Yamamoto | 731e189 | 2017-10-06 19:41:34 +0900 | [diff] [blame] | 130 | .. _whatsnew37-pep539: |
| 131 | |
| 132 | PEP 539: A New C-API for Thread-Local Storage in CPython |
| 133 | -------------------------------------------------------- |
| 134 | |
| 135 | While Python provides a C API for thread-local storage support; the existing |
| 136 | :ref:`Thread Local Storage (TLS) API <thread-local-storage-api>` has used |
| 137 | :c:type:`int` to represent TLS keys across all platforms. This has not |
| 138 | generally been a problem for officially-support platforms, but that is neither |
| 139 | POSIX-compliant, nor portable in any practical sense. |
| 140 | |
| 141 | :pep:`539` changes this by providing a new :ref:`Thread Specific Storage (TSS) |
| 142 | API <thread-specific-storage-api>` to CPython which supersedes use of the |
| 143 | existing TLS API within the CPython interpreter, while deprecating the existing |
| 144 | API. The TSS API uses a new type :c:type:`Py_tss_t` instead of :c:type:`int` |
| 145 | to represent TSS keys--an opaque type the definition of which may depend on |
| 146 | the underlying TLS implementation. Therefore, this will allow to build CPython |
| 147 | on platforms where the native TLS key is defined in a way that cannot be safely |
| 148 | cast to :c:type:`int`. |
| 149 | |
| 150 | Note that on platforms where the native TLS key is defined in a way that cannot |
| 151 | be safely cast to :c:type:`int`, all functions of the existing TLS API will be |
| 152 | no-op and immediately return failure. This indicates clearly that the old API |
| 153 | is not supported on platforms where it cannot be used reliably, and that no |
| 154 | effort will be made to add such support. |
| 155 | |
| 156 | .. seealso:: |
| 157 | |
| 158 | :pep:`539` -- A New C-API for Thread-Local Storage in CPython |
| 159 | PEP written by Erik M. Bray; implementation by Masayuki Yamamoto. |
| 160 | |
| 161 | |
Ivan Levkivskyi | 5364b5c | 2017-12-14 11:59:44 +0100 | [diff] [blame] | 162 | PEP 562: Customization of access to module attributes |
| 163 | ----------------------------------------------------- |
| 164 | |
| 165 | It is sometimes convenient to customize or otherwise have control over access |
| 166 | to module attributes. A typical example is managing deprecation warnings. |
| 167 | Typical workarounds are assigning ``__class__`` of a module object to |
| 168 | a custom subclass of :class:`types.ModuleType` or replacing the ``sys.modules`` |
| 169 | item with a custom wrapper instance. This procedure is now simplified by |
| 170 | recognizing ``__getattr__`` defined directly in a module that would act like |
| 171 | a normal ``__getattr__`` method, except that it will be defined on module |
| 172 | *instances*. |
| 173 | |
| 174 | .. seealso:: |
| 175 | |
| 176 | :pep:`562` -- Module ``__getattr__`` and ``__dir__`` |
| 177 | PEP written and implemented by Ivan Levkivskyi |
| 178 | |
| 179 | |
Victor Stinner | c29b585 | 2017-11-02 07:28:27 -0700 | [diff] [blame] | 180 | PEP 564: Add new time functions with nanosecond resolution |
| 181 | ---------------------------------------------------------- |
| 182 | |
| 183 | Add six new "nanosecond" variants of existing functions to the :mod:`time` |
| 184 | module: |
| 185 | |
| 186 | * :func:`time.clock_gettime_ns` |
| 187 | * :func:`time.clock_settime_ns` |
| 188 | * :func:`time.monotonic_ns` |
| 189 | * :func:`time.perf_counter_ns` |
| 190 | * :func:`time.process_time_ns` |
| 191 | * :func:`time.time_ns` |
| 192 | |
| 193 | While similar to the existing functions without the ``_ns`` suffix, they |
| 194 | provide nanosecond resolution: they return a number of nanoseconds as a Python |
| 195 | ``int``. |
| 196 | |
| 197 | The ``time.time_ns()`` resolution is 3 times better than the ``time.time()`` |
| 198 | resolution on Linux and Windows. |
| 199 | |
| 200 | .. seealso:: |
| 201 | |
| 202 | :pep:`564` -- Add new time functions with nanosecond resolution |
| 203 | PEP written and implemented by Victor Stinner |
| 204 | |
| 205 | |
Victor Stinner | 91106cd | 2017-12-13 12:29:09 +0100 | [diff] [blame] | 206 | PEP 540: Add a new UTF-8 mode |
| 207 | ----------------------------- |
| 208 | |
| 209 | Add a new UTF-8 mode to ignore the locale, use the UTF-8 encoding, and change |
| 210 | :data:`sys.stdin` and :data:`sys.stdout` error handlers to ``surrogateescape``. |
| 211 | This mode is enabled by default in the POSIX locale, but otherwise disabled by |
| 212 | default. |
| 213 | |
| 214 | The new :option:`-X` ``utf8`` command line option and :envvar:`PYTHONUTF8` |
| 215 | environment variable are added to control the UTF-8 mode. |
| 216 | |
| 217 | .. seealso:: |
| 218 | |
| 219 | :pep:`540` -- Add a new UTF-8 mode |
| 220 | PEP written and implemented by Victor Stinner |
| 221 | |
| 222 | |
Victor Stinner | 5e3806f | 2017-11-30 11:40:24 +0100 | [diff] [blame] | 223 | New Development Mode: -X dev |
| 224 | ---------------------------- |
Victor Stinner | ccb0442 | 2017-11-16 03:20:31 -0800 | [diff] [blame] | 225 | |
Victor Stinner | 747f48e | 2017-12-12 22:59:48 +0100 | [diff] [blame] | 226 | Add a new "development mode": :option:`-X` ``dev`` command line option and |
| 227 | :envvar:`PYTHONDEVMODE` environment variable to enable CPython's "development |
| 228 | mode", introducing additional runtime checks which are too expensive to be |
| 229 | enabled by default. See :option:`-X` ``dev`` documentation for the effects of |
| 230 | the development mode. |
Victor Stinner | ccb0442 | 2017-11-16 03:20:31 -0800 | [diff] [blame] | 231 | |
Benjamin Peterson | 42aa93b | 2017-12-09 10:26:52 -0800 | [diff] [blame] | 232 | Hash-based pycs |
| 233 | --------------- |
| 234 | |
| 235 | Python has traditionally checked the up-to-dateness of bytecode cache files |
| 236 | (i.e., ``.pyc`` files) by comparing the source metadata (last-modified timestamp |
| 237 | and size) with source metadata saved in the cache file header when it was |
| 238 | generated. While effective, this invalidation method has its drawbacks. When |
| 239 | filesystem timestamps are too coarse, Python can miss source updates, leading to |
| 240 | user confusion. Additionally, having a timestamp in the cache file is |
| 241 | problematic for `build reproduciblity <https://reproducible-builds.org/>`_ and |
| 242 | content-based build systems. |
| 243 | |
| 244 | :pep:`552` extends the pyc format to allow the hash of the source file to be |
| 245 | used for invalidation instead of the source timestamp. Such ``.pyc`` files are |
| 246 | called "hash-based". By default, Python still uses timestamp-based invalidation |
| 247 | and does not generate hash-based ``.pyc`` files at runtime. Hash-based ``.pyc`` |
| 248 | files may be generated with :mod:`py_compile` or :mod:`compileall`. |
| 249 | |
| 250 | Hash-based ``.pyc`` files come in two variants: checked and unchecked. Python |
| 251 | validates checked hash-based ``.pyc`` files against the corresponding source |
| 252 | files at runtime but doesn't do so for unchecked hash-based pycs. Unchecked |
| 253 | hash-based ``.pyc`` files are a useful performance optimization for environments |
| 254 | where a system external to Python (e.g., the build system) is responsible for |
| 255 | keeping ``.pyc`` files up-to-date. |
| 256 | |
| 257 | See :ref:`pyc-invalidation` for more information. |
| 258 | |
Victor Stinner | ccb0442 | 2017-11-16 03:20:31 -0800 | [diff] [blame] | 259 | |
Ned Deily | 4829bc6 | 2016-09-12 17:29:04 -0400 | [diff] [blame] | 260 | Other Language Changes |
| 261 | ====================== |
| 262 | |
Serhiy Storchaka | 5bb8b91 | 2016-12-16 19:19:02 +0200 | [diff] [blame] | 263 | * More than 255 arguments can now be passed to a function, and a function can |
Garvit Khatri | 1cf93a7 | 2017-03-28 23:43:38 +0800 | [diff] [blame] | 264 | now have more than 255 parameters. (Contributed by Serhiy Storchaka in |
| 265 | :issue:`12844` and :issue:`18896`.) |
Ned Deily | 4829bc6 | 2016-09-12 17:29:04 -0400 | [diff] [blame] | 266 | |
Serhiy Storchaka | dd1da7f | 2016-12-19 18:51:37 +0200 | [diff] [blame] | 267 | * :meth:`bytes.fromhex` and :meth:`bytearray.fromhex` now ignore all ASCII |
Garvit Khatri | 1cf93a7 | 2017-03-28 23:43:38 +0800 | [diff] [blame] | 268 | whitespace, not only spaces. (Contributed by Robert Xiao in :issue:`28927`.) |
Serhiy Storchaka | dd1da7f | 2016-12-19 18:51:37 +0200 | [diff] [blame] | 269 | |
Matthias Bussonnier | 1bc1564 | 2017-02-22 07:06:50 -0800 | [diff] [blame] | 270 | * :exc:`ImportError` now displays module name and module ``__file__`` path when |
Garvit Khatri | 1cf93a7 | 2017-03-28 23:43:38 +0800 | [diff] [blame] | 271 | ``from ... import ...`` fails. (Contributed by Matthias Bussonnier in :issue:`29546`.) |
Matthias Bussonnier | 1bc1564 | 2017-02-22 07:06:50 -0800 | [diff] [blame] | 272 | |
Serhiy Storchaka | f93234b | 2017-05-09 22:31:05 +0300 | [diff] [blame] | 273 | * Circular imports involving absolute imports with binding a submodule to |
| 274 | a name are now supported. |
| 275 | (Contributed by Serhiy Storchaka in :issue:`30024`.) |
| 276 | |
Serhiy Storchaka | 7e19dbc | 2017-05-13 12:40:52 +0300 | [diff] [blame] | 277 | * ``object.__format__(x, '')`` is now equivalent to ``str(x)`` rather than |
| 278 | ``format(str(self), '')``. |
| 279 | (Contributed by Serhiy Storchaka in :issue:`28974`.) |
| 280 | |
Ned Deily | 4829bc6 | 2016-09-12 17:29:04 -0400 | [diff] [blame] | 281 | |
| 282 | New Modules |
| 283 | =========== |
| 284 | |
Barry Warsaw | deae6b4 | 2017-12-30 15:18:06 -0500 | [diff] [blame] | 285 | importlib.resources |
| 286 | ------------------- |
| 287 | |
| 288 | This module provides several new APIs and one new ABC for access to, opening, |
| 289 | and reading *resources* inside packages. Resources are roughly akin to files |
| 290 | inside of packages, but they needn't be actual files on the physical file |
| 291 | system. Module loaders can implement the |
| 292 | :class:`importlib.abc.ResourceReader` ABC to support this new module's API. |
Ned Deily | 4829bc6 | 2016-09-12 17:29:04 -0400 | [diff] [blame] | 293 | |
| 294 | |
| 295 | Improved Modules |
| 296 | ================ |
| 297 | |
Pierre Quentel | cc3fa20 | 2017-05-08 14:08:34 +0200 | [diff] [blame] | 298 | |
R. David Murray | 0f6b9d2 | 2017-09-06 20:25:40 -0400 | [diff] [blame] | 299 | argparse |
| 300 | -------- |
| 301 | |
| 302 | The :meth:`~argparse.ArgumentParser.parse_intermixed_args` supports letting |
| 303 | the user intermix options and positional arguments on the command line, |
| 304 | as is possible in many unix commands. It supports most but not all |
| 305 | argparse features. (Contributed by paul.j3 in :issue:`14191`.) |
| 306 | |
| 307 | |
Xiang Zhang | 13f1f42 | 2017-05-03 11:16:21 +0800 | [diff] [blame] | 308 | binascii |
| 309 | -------- |
| 310 | |
| 311 | The :func:`~binascii.b2a_uu` function now accepts an optional *backtick* |
| 312 | keyword argument. When it's true, zeros are represented by ``'`'`` |
| 313 | instead of spaces. (Contributed by Xiang Zhang in :issue:`30103`.) |
| 314 | |
Oz N Tiram | 8b7a4cc | 2017-06-06 11:35:59 +0200 | [diff] [blame] | 315 | |
| 316 | calendar |
| 317 | -------- |
| 318 | |
Walter Dörwald | f5c58c7 | 2017-06-26 18:31:52 +0200 | [diff] [blame] | 319 | The class :class:`~calendar.HTMLCalendar` has new class attributes which ease |
| 320 | the customisation of the CSS classes in the produced HTML calendar. |
Oz N Tiram | 8b7a4cc | 2017-06-06 11:35:59 +0200 | [diff] [blame] | 321 | (Contributed by Oz Tiram in :issue:`30095`.) |
| 322 | |
| 323 | cgi |
| 324 | --- |
| 325 | |
| 326 | :func:`~cgi.parse_multipart` returns the same results as |
| 327 | :class:`~FieldStorage` : for non-file fields, the value associated to a key |
| 328 | is a list of strings, not bytes. |
| 329 | (Contributed by Pierre Quentel in :issue:`29979`.) |
| 330 | |
Jelle Zijlstra | 2e62469 | 2017-04-30 18:25:58 -0700 | [diff] [blame] | 331 | contextlib |
| 332 | ---------- |
| 333 | |
Jelle Zijlstra | 176baa3 | 2017-12-13 17:19:17 -0800 | [diff] [blame] | 334 | :func:`~contextlib.asynccontextmanager` and |
| 335 | :class:`~contextlib.AbstractAsyncContextManager` have been added. (Contributed |
| 336 | by Jelle Zijlstra in :issue:`29679` and :issue:`30241`.) |
Jelle Zijlstra | 2e62469 | 2017-04-30 18:25:58 -0700 | [diff] [blame] | 337 | |
Sanyam Khurana | 7973e27 | 2017-11-08 16:20:56 +0530 | [diff] [blame] | 338 | cProfile |
| 339 | -------- |
| 340 | |
| 341 | cProfile command line now accepts `-m module_name` as an alternative to |
| 342 | script path. (Contributed by Sanyam Khurana in :issue:`21862`.) |
| 343 | |
Serhiy Storchaka | eab3ff7 | 2017-10-24 19:36:17 +0300 | [diff] [blame] | 344 | crypt |
| 345 | ----- |
| 346 | |
| 347 | Added support for the Blowfish method. |
| 348 | (Contributed by Serhiy Storchaka in :issue:`31664`.) |
| 349 | |
Serhiy Storchaka | cede8c9 | 2017-11-16 13:22:51 +0200 | [diff] [blame] | 350 | The :func:`~crypt.mksalt` function now allows to specify the number of rounds |
| 351 | for hashing. (Contributed by Serhiy Storchaka in :issue:`31702`.) |
| 352 | |
Serhiy Storchaka | 1efbf92 | 2017-06-11 14:09:39 +0300 | [diff] [blame] | 353 | dis |
| 354 | --- |
| 355 | |
| 356 | The :func:`~dis.dis` function now is able to |
| 357 | disassemble nested code objects (the code of comprehensions, generator |
| 358 | expressions and nested functions, and the code used for building nested |
| 359 | classes). (Contributed by Serhiy Storchaka in :issue:`11822`.) |
| 360 | |
Ryan Gonzalez | f9f87f0 | 2017-04-14 04:00:25 -0500 | [diff] [blame] | 361 | distutils |
| 362 | --------- |
| 363 | |
| 364 | README.rst is now included in the list of distutils standard READMEs and |
| 365 | therefore included in source distributions. |
| 366 | (Contributed by Ryan Gonzalez in :issue:`11913`.) |
| 367 | |
Neil Schemenauer | 8837dd0 | 2017-12-04 18:58:12 -0800 | [diff] [blame] | 368 | :class:`distutils.core.setup` now warns if the ``classifiers``, ``keywords`` |
| 369 | and ``platforms`` fields are not specified as a list or a string. |
Berker Peksag | dcaed6b | 2017-11-23 21:34:20 +0300 | [diff] [blame] | 370 | (Contributed by Berker Peksag in :issue:`19610`.) |
| 371 | |
Nir Soffer | ad455cd | 2017-11-06 23:16:37 +0200 | [diff] [blame] | 372 | http.client |
| 373 | ----------- |
| 374 | |
| 375 | Add Configurable *blocksize* to ``HTTPConnection`` and |
| 376 | ``HTTPSConnection`` for improved upload throughput. |
| 377 | (Contributed by Nir Soffer in :issue:`31945`.) |
| 378 | |
Pierre Quentel | 351adda | 2017-04-02 12:26:12 +0200 | [diff] [blame] | 379 | http.server |
| 380 | ----------- |
| 381 | |
| 382 | :class:`~http.server.SimpleHTTPRequestHandler` supports the HTTP |
| 383 | If-Modified-Since header. The server returns the 304 response status if the |
| 384 | target file was not modified after the time specified in the header. |
| 385 | (Contributed by Pierre Quentel in :issue:`29654`.) |
| 386 | |
Stéphane Wirtel | a17a2f5 | 2017-05-24 09:29:06 +0200 | [diff] [blame] | 387 | Add the parameter ``directory`` to the :class:`~http.server.SimpleHTTPRequestHandler` |
| 388 | and the ``--directory`` to the command line of the module :mod:`~http.server`. |
| 389 | With this parameter, the server serves the specified directory, by default it uses the current working directory. |
| 390 | (Contributed by Stéphane Wirtel and Julien Palard in :issue:`28707`.) |
| 391 | |
Garvit Khatri | 1cf93a7 | 2017-03-28 23:43:38 +0800 | [diff] [blame] | 392 | locale |
| 393 | ------ |
| 394 | |
| 395 | Added another argument *monetary* in :meth:`format_string` of :mod:`locale`. |
| 396 | If *monetary* is true, the conversion uses monetary thousands separator and |
| 397 | grouping strings. (Contributed by Garvit in :issue:`10379`.) |
| 398 | |
Victor Stinner | 91106cd | 2017-12-13 12:29:09 +0100 | [diff] [blame] | 399 | The :func:`locale.getpreferredencoding` function now always returns ``'UTF-8'`` |
| 400 | on Android or in the UTF-8 mode (:option:`-X` ``utf8`` option), the locale and |
| 401 | the *do_setlocale* argument are ignored. |
| 402 | |
Mark Dickinson | a0ce375 | 2017-04-05 18:34:27 +0100 | [diff] [blame] | 403 | math |
| 404 | ---- |
| 405 | |
| 406 | New :func:`~math.remainder` function, implementing the IEEE 754-style remainder |
| 407 | operation. (Contributed by Mark Dickinson in :issue:`29962`.) |
| 408 | |
Serhiy Storchaka | 8f6b344 | 2017-03-07 14:33:21 +0200 | [diff] [blame] | 409 | os |
| 410 | -- |
| 411 | |
Garvit Khatri | 1cf93a7 | 2017-03-28 23:43:38 +0800 | [diff] [blame] | 412 | Added support for :class:`bytes` paths in :func:`~os.fwalk`. (Contributed by |
| 413 | Serhiy Storchaka in :issue:`28682`.) |
Serhiy Storchaka | 8f6b344 | 2017-03-07 14:33:21 +0200 | [diff] [blame] | 414 | |
Serhiy Storchaka | ea720fe | 2017-03-30 09:12:31 +0300 | [diff] [blame] | 415 | Added support for :ref:`file descriptors <path_fd>` in :func:`~os.scandir` |
| 416 | on Unix. (Contributed by Serhiy Storchaka in :issue:`25996`.) |
| 417 | |
Antoine Pitrou | f7ecfac | 2017-05-28 11:35:14 +0200 | [diff] [blame] | 418 | New function :func:`os.register_at_fork` allows registering Python callbacks |
| 419 | to be executed on a process fork. (Contributed by Antoine Pitrou in |
| 420 | :issue:`16500`.) |
| 421 | |
Barry Warsaw | 35425d6 | 2017-09-22 12:29:42 -0400 | [diff] [blame] | 422 | pdb |
| 423 | --- |
| 424 | |
Berker Peksag | 12d6056 | 2017-11-04 15:17:56 +0300 | [diff] [blame] | 425 | :func:`~pdb.set_trace` now takes an optional *header* keyword-only |
Barry Warsaw | 35425d6 | 2017-09-22 12:29:42 -0400 | [diff] [blame] | 426 | argument. If given, this is printed to the console just before debugging |
Berker Peksag | 12d6056 | 2017-11-04 15:17:56 +0300 | [diff] [blame] | 427 | begins. (Contributed by Barry Warsaw in :issue:`31389`.) |
Barry Warsaw | 35425d6 | 2017-09-22 12:29:42 -0400 | [diff] [blame] | 428 | |
Mario Corchero | 9f1e5f1 | 2018-01-06 07:53:05 +0000 | [diff] [blame^] | 429 | pdb command line now accepts `-m module_name` as an alternative to |
| 430 | script file. (Contributed by Mario Corchero in :issue:`32206`.) |
| 431 | |
| 432 | |
Serhiy Storchaka | 3557b05 | 2017-10-24 23:31:42 +0300 | [diff] [blame] | 433 | re |
| 434 | -- |
| 435 | |
| 436 | The flags :const:`re.ASCII`, :const:`re.LOCALE` and :const:`re.UNICODE` |
| 437 | can be set within the scope of a group. |
| 438 | (Contributed by Serhiy Storchaka in :issue:`31690`.) |
| 439 | |
Serhiy Storchaka | 70d56fb | 2017-12-04 14:29:05 +0200 | [diff] [blame] | 440 | :func:`re.split` now supports splitting on a pattern like ``r'\b'``, |
| 441 | ``'^$'`` or ``(?=-)`` that matches an empty string. |
| 442 | (Contributed by Serhiy Storchaka in :issue:`25054`.) |
| 443 | |
Barry Warsaw | 973b901 | 2017-09-04 17:29:27 -0400 | [diff] [blame] | 444 | string |
| 445 | ------ |
| 446 | |
| 447 | :class:`string.Template` now lets you to optionally modify the regular |
| 448 | expression pattern for braced placeholders and non-braced placeholders |
| 449 | separately. (Contributed by Barry Warsaw in :issue:`1198569`.) |
| 450 | |
Segev Finer | b2a6083 | 2017-12-18 11:28:19 +0200 | [diff] [blame] | 451 | subprocess |
| 452 | ---------- |
| 453 | |
| 454 | On Windows the default for *close_fds* was changed from :const:`False` to |
| 455 | :const:`True` when redirecting the standard handles. It's now possible to set |
| 456 | *close_fds* to :const:`True` when redirecting the standard handles. See |
| 457 | :class:`subprocess.Popen`. |
| 458 | |
| 459 | This means that *close_fds* now defaults to :const:`True` on all supported |
| 460 | platforms. |
| 461 | |
Victor Stinner | 5e3806f | 2017-11-30 11:40:24 +0100 | [diff] [blame] | 462 | sys |
| 463 | --- |
| 464 | |
| 465 | Added :attr:`sys.flags.dev_mode` flag for the new development mode. |
| 466 | |
Victor Stinner | a64ce97 | 2017-11-02 04:19:19 -0700 | [diff] [blame] | 467 | time |
| 468 | ---- |
| 469 | |
Victor Stinner | c29b585 | 2017-11-02 07:28:27 -0700 | [diff] [blame] | 470 | The :pep:`564` added six new functions with nanosecond resolution: |
| 471 | |
| 472 | * :func:`time.clock_gettime_ns` |
| 473 | * :func:`time.clock_settime_ns` |
| 474 | * :func:`time.monotonic_ns` |
| 475 | * :func:`time.perf_counter_ns` |
| 476 | * :func:`time.process_time_ns` |
| 477 | * :func:`time.time_ns` |
| 478 | |
Victor Stinner | a64ce97 | 2017-11-02 04:19:19 -0700 | [diff] [blame] | 479 | Add new clock identifiers: |
| 480 | |
| 481 | * :data:`time.CLOCK_BOOTTIME` (Linux): Identical to |
| 482 | :data:`time.CLOCK_MONOTONIC`, except it also includes any time that the |
| 483 | system is suspended. |
| 484 | * :data:`time.CLOCK_PROF` (FreeBSD, NetBSD and OpenBSD): High-resolution |
| 485 | per-process timer from the CPU. |
| 486 | * :data:`time.CLOCK_UPTIME` (FreeBSD, OpenBSD): Time whose absolute value is |
| 487 | the time the system has been running and not suspended, providing accurate |
| 488 | uptime measurement, both absolute and interval. |
| 489 | |
Antoine Pitrou | 4bd41c9 | 2017-11-15 22:52:21 +0100 | [diff] [blame] | 490 | Added functions :func:`time.thread_time` and :func:`time.thread_time_ns` |
| 491 | to get per-thread CPU time measurements. |
| 492 | (Contributed by Antoine Pitrou in :issue:`32025`.) |
| 493 | |
Jonas Haag | 4d193bc | 2017-11-28 20:40:44 +0100 | [diff] [blame] | 494 | |
| 495 | unittest |
| 496 | -------- |
| 497 | Added new command-line option ``-k`` to filter tests to run with a substring or |
| 498 | Unix shell-like pattern. For example, ``python -m unittest -k foo`` runs the |
| 499 | tests ``foo_tests.SomeTest.test_something``, ``bar_tests.SomeTest.test_foo``, |
| 500 | but not ``bar_tests.FooTest.test_something``. |
| 501 | |
| 502 | |
Serhiy Storchaka | d9c956f | 2017-01-11 20:13:03 +0200 | [diff] [blame] | 503 | unittest.mock |
| 504 | ------------- |
| 505 | |
| 506 | The :const:`~unittest.mock.sentinel` attributes now preserve their identity |
Garvit Khatri | 1cf93a7 | 2017-03-28 23:43:38 +0800 | [diff] [blame] | 507 | when they are :mod:`copied <copy>` or :mod:`pickled <pickle>`. (Contributed by |
| 508 | Serhiy Storchaka in :issue:`20804`.) |
Serhiy Storchaka | d9c956f | 2017-01-11 20:13:03 +0200 | [diff] [blame] | 509 | |
Mario Corchero | 552be9d | 2017-10-17 12:35:11 +0100 | [diff] [blame] | 510 | New function :const:`~unittest.mock.seal` will disable the creation of mock |
| 511 | children by preventing to get or set any new attribute on the sealed mock. |
| 512 | The sealing process is performed recursively. (Contributed by Mario Corchero |
| 513 | in :issue:`30541`.) |
| 514 | |
Xiang Zhang | 267b9d2 | 2017-02-28 17:12:52 +0800 | [diff] [blame] | 515 | xmlrpc.server |
| 516 | ------------- |
| 517 | |
| 518 | :meth:`register_function` of :class:`xmlrpc.server.SimpleXMLRPCDispatcher` and |
Garvit Khatri | 1cf93a7 | 2017-03-28 23:43:38 +0800 | [diff] [blame] | 519 | its subclasses can be used as a decorator. (Contributed by Xiang Zhang in |
| 520 | :issue:`7769`.) |
Xiang Zhang | 267b9d2 | 2017-02-28 17:12:52 +0800 | [diff] [blame] | 521 | |
Benjamin Peterson | 279a962 | 2017-06-22 22:31:08 -0700 | [diff] [blame] | 522 | unicodedata |
| 523 | ----------- |
| 524 | |
| 525 | The internal :mod:`unicodedata` database has been upgraded to use `Unicode 10 |
| 526 | <http://www.unicode.org/versions/Unicode10.0.0/>`_. (Contributed by Benjamin |
| 527 | Peterson.) |
| 528 | |
Ratnadeep Debnath | 21024f0 | 2017-02-25 14:30:28 +0530 | [diff] [blame] | 529 | urllib.parse |
| 530 | ------------ |
| 531 | |
Daniel Himmelstein | dadca48 | 2017-08-10 21:45:12 -0400 | [diff] [blame] | 532 | :func:`urllib.parse.quote` has been updated from RFC 2396 to RFC 3986, |
Ratnadeep Debnath | 21024f0 | 2017-02-25 14:30:28 +0530 | [diff] [blame] | 533 | adding `~` to the set of characters that is never quoted by default. |
| 534 | (Contributed by Christian Theune and Ratnadeep Debnath in :issue:`16285`.) |
| 535 | |
Xiang Zhang | 13f1f42 | 2017-05-03 11:16:21 +0800 | [diff] [blame] | 536 | uu |
| 537 | -- |
| 538 | |
| 539 | Function :func:`~uu.encode` now accepts an optional *backtick* |
| 540 | keyword argument. When it's true, zeros are represented by ``'`'`` |
| 541 | instead of spaces. (Contributed by Xiang Zhang in :issue:`30103`.) |
| 542 | |
Victor Stinner | 747f48e | 2017-12-12 22:59:48 +0100 | [diff] [blame] | 543 | warnings |
| 544 | -------- |
| 545 | |
| 546 | The initialization of the default warnings filters has changed as follows: |
| 547 | |
| 548 | * warnings enabled via command line options (including those for :option:`-b` |
| 549 | and the new CPython-specific ``-X dev`` option) are always passed to the |
| 550 | warnings machinery via the ``sys.warnoptions`` attribute. |
| 551 | * warnings filters enabled via the command line or the environment now have the |
| 552 | following precedence order: |
| 553 | |
| 554 | * the ``BytesWarning`` filter for :option:`-b` (or ``-bb``) |
| 555 | * any filters specified with :option:`-W` |
| 556 | * any filters specified with :envvar:`PYTHONWARNINGS` |
| 557 | * any other CPython specific filters (e.g. the ``default`` filter added |
| 558 | for the new ``-X dev`` mode) |
| 559 | * any implicit filters defined directly by the warnings machinery |
| 560 | * in CPython debug builds, all warnings are now displayed by default (the |
| 561 | implicit filter list is empty) |
| 562 | |
| 563 | (Contributed by Nick Coghlan and Victor Stinner in :issue:`20361`, |
| 564 | :issue:`32043`, and :issue:`32230`) |
| 565 | |
scoder | 101a5e8 | 2017-09-30 15:35:21 +0200 | [diff] [blame] | 566 | xml.etree |
| 567 | --------- |
| 568 | |
| 569 | :ref:`ElementPath <elementtree-xpath>` predicates in the :meth:`find` |
| 570 | methods can now compare text of the current node with ``[. = "text"]``, |
| 571 | not only text in children. Predicates also allow adding spaces for |
| 572 | better readability. (Contributed by Stefan Behnel in :issue:`31648`.) |
| 573 | |
Paul Moore | 0780bf7 | 2017-08-26 18:04:12 +0100 | [diff] [blame] | 574 | zipapp |
| 575 | ------ |
| 576 | |
| 577 | Function :func:`zipapp.create_archive` now accepts an optional *filter* |
Zhiming Wang | d87b105 | 2017-09-29 13:31:52 -0400 | [diff] [blame] | 578 | argument to allow the user to select which files should be included in the |
| 579 | archive, and an optional *compressed* argument to generate a compressed |
Paul Moore | 0780bf7 | 2017-08-26 18:04:12 +0100 | [diff] [blame] | 580 | archive. |
| 581 | |
Zhiming Wang | d87b105 | 2017-09-29 13:31:52 -0400 | [diff] [blame] | 582 | A command line option ``--compress`` has also been added to support |
| 583 | compression. |
| 584 | |
Ned Deily | 4829bc6 | 2016-09-12 17:29:04 -0400 | [diff] [blame] | 585 | |
| 586 | Optimizations |
| 587 | ============= |
| 588 | |
Yury Selivanov | f239213 | 2016-12-13 19:03:51 -0500 | [diff] [blame] | 589 | * Added two new opcodes: ``LOAD_METHOD`` and ``CALL_METHOD`` to avoid |
| 590 | instantiation of bound method objects for method calls, which results |
Garvit Khatri | 1cf93a7 | 2017-03-28 23:43:38 +0800 | [diff] [blame] | 591 | in method calls being faster up to 20%. (Contributed by Yury Selivanov and |
| 592 | INADA Naoki in :issue:`26110`.) |
Yury Selivanov | f239213 | 2016-12-13 19:03:51 -0500 | [diff] [blame] | 593 | |
Serhiy Storchaka | 0a58f72 | 2017-03-30 09:11:10 +0300 | [diff] [blame] | 594 | * Searching some unlucky Unicode characters (like Ukrainian capital "Є") |
Cody Scott | 72fa301 | 2017-11-09 13:58:59 -0500 | [diff] [blame] | 595 | in a string was up to 25 times slower than searching other characters. |
| 596 | Now it is slower only by 3 times in the worst case. |
Serhiy Storchaka | 0a58f72 | 2017-03-30 09:11:10 +0300 | [diff] [blame] | 597 | (Contributed by Serhiy Storchaka in :issue:`24821`.) |
| 598 | |
Serhiy Storchaka | 97553fd | 2017-03-11 23:37:16 +0200 | [diff] [blame] | 599 | * Fast implementation from standard C library is now used for functions |
Paul Romano | 992f613 | 2017-09-15 12:00:57 -0500 | [diff] [blame] | 600 | :func:`~math.erf` and :func:`~math.erfc` in the :mod:`math` module. |
| 601 | (Contributed by Serhiy Storchaka in :issue:`26121`.) |
Serhiy Storchaka | 97553fd | 2017-03-11 23:37:16 +0200 | [diff] [blame] | 602 | |
Serhiy Storchaka | ea720fe | 2017-03-30 09:12:31 +0300 | [diff] [blame] | 603 | * The :func:`os.fwalk` function has been sped up by 2 times. This was done |
| 604 | using the :func:`os.scandir` function. |
| 605 | (Contributed by Serhiy Storchaka in :issue:`25996`.) |
| 606 | |
Serhiy Storchaka | d4d79bc | 2017-11-04 14:16:35 +0200 | [diff] [blame] | 607 | * The :func:`shutil.rmtree` function has been sped up to 20--40%. |
| 608 | This was done using the :func:`os.scandir` function. |
| 609 | (Contributed by Serhiy Storchaka in :issue:`28564`.) |
| 610 | |
Serhiy Storchaka | 6d336a0 | 2017-05-09 23:37:14 +0300 | [diff] [blame] | 611 | * Optimized case-insensitive matching and searching of :mod:`regular |
| 612 | expressions <re>`. Searching some patterns can now be up to 20 times faster. |
| 613 | (Contributed by Serhiy Storchaka in :issue:`30285`.) |
| 614 | |
INADA Naoki | c1c47c1 | 2017-10-05 17:19:26 +0900 | [diff] [blame] | 615 | * :func:`re.compile` now converts ``flags`` parameter to int object if |
| 616 | it is ``RegexFlag``. It is now as fast as Python 3.5, and faster than |
Cody Scott | 72fa301 | 2017-11-09 13:58:59 -0500 | [diff] [blame] | 617 | Python 3.6 by about 10% depending on the pattern. |
INADA Naoki | c1c47c1 | 2017-10-05 17:19:26 +0900 | [diff] [blame] | 618 | (Contributed by INADA Naoki in :issue:`31671`.) |
| 619 | |
Giampaolo Rodola | fbfaa6f | 2017-06-09 22:20:41 +0200 | [diff] [blame] | 620 | * :meth:`selectors.EpollSelector.modify`, :meth:`selectors.PollSelector.modify` |
| 621 | and :meth:`selectors.DevpollSelector.modify` may be around 10% faster under |
| 622 | heavy loads. (Contributed by Giampaolo Rodola' in :issue:`30014`) |
Ned Deily | 4829bc6 | 2016-09-12 17:29:04 -0400 | [diff] [blame] | 623 | |
INADA Naoki | 7ea143a | 2017-12-14 16:47:20 +0900 | [diff] [blame] | 624 | * Constant folding is moved from peephole optimizer to new AST optimizer. |
| 625 | (Contributed by Eugene Toder and INADA Naoki in :issue:`29469`) |
| 626 | |
Ned Deily | 4829bc6 | 2016-09-12 17:29:04 -0400 | [diff] [blame] | 627 | Build and C API Changes |
| 628 | ======================= |
| 629 | |
Zachary Ware | f40d4dd | 2016-09-17 01:25:24 -0500 | [diff] [blame] | 630 | * A full copy of libffi is no longer bundled for use when building the |
| 631 | :mod:`_ctypes <ctypes>` module on non-OSX UNIX platforms. An installed copy |
| 632 | of libffi is now required when building ``_ctypes`` on such platforms. |
| 633 | Contributed by Zachary Ware in :issue:`27979`. |
Ned Deily | 4829bc6 | 2016-09-12 17:29:04 -0400 | [diff] [blame] | 634 | |
Serhiy Storchaka | 007d7ff | 2016-11-22 07:58:08 +0200 | [diff] [blame] | 635 | * The fields :c:member:`name` and :c:member:`doc` of structures |
| 636 | :c:type:`PyMemberDef`, :c:type:`PyGetSetDef`, |
| 637 | :c:type:`PyStructSequence_Field`, :c:type:`PyStructSequence_Desc`, |
| 638 | and :c:type:`wrapperbase` are now of type ``const char *`` rather of |
| 639 | ``char *``. (Contributed by Serhiy Storchaka in :issue:`28761`.) |
| 640 | |
Serhiy Storchaka | 2a404b6 | 2017-01-22 23:07:07 +0200 | [diff] [blame] | 641 | * The result of :c:func:`PyUnicode_AsUTF8AndSize` and :c:func:`PyUnicode_AsUTF8` |
Garvit Khatri | 1cf93a7 | 2017-03-28 23:43:38 +0800 | [diff] [blame] | 642 | is now of type ``const char *`` rather of ``char *``. (Contributed by Serhiy |
| 643 | Storchaka in :issue:`28769`.) |
Serhiy Storchaka | 2a404b6 | 2017-01-22 23:07:07 +0200 | [diff] [blame] | 644 | |
Oren Milman | 0ccc0f6 | 2017-10-08 11:17:46 +0300 | [diff] [blame] | 645 | * The result of :c:func:`PyMapping_Keys`, :c:func:`PyMapping_Values` and |
| 646 | :c:func:`PyMapping_Items` is now always a list, rather than a list or a |
| 647 | tuple. (Contributed by Oren Milman in :issue:`28280`.) |
| 648 | |
Serhiy Storchaka | 6e08baf | 2017-01-25 13:27:44 +0200 | [diff] [blame] | 649 | * Added functions :c:func:`PySlice_Unpack` and :c:func:`PySlice_AdjustIndices`. |
| 650 | (Contributed by Serhiy Storchaka in :issue:`27867`.) |
| 651 | |
Antoine Pitrou | f7ecfac | 2017-05-28 11:35:14 +0200 | [diff] [blame] | 652 | * :c:func:`PyOS_AfterFork` is deprecated in favour of the new functions |
| 653 | :c:func:`PyOS_BeforeFork`, :c:func:`PyOS_AfterFork_Parent` and |
| 654 | :c:func:`PyOS_AfterFork_Child`. (Contributed by Antoine Pitrou in |
| 655 | :issue:`16500`.) |
| 656 | |
Zachary Ware | cb8c048 | 2017-06-15 22:34:59 -0500 | [diff] [blame] | 657 | * The Windows build process no longer depends on Subversion to pull in external |
| 658 | sources, a Python script is used to download zipfiles from GitHub instead. |
| 659 | If Python 3.6 is not found on the system (via ``py -3.6``), NuGet is used to |
| 660 | download a copy of 32-bit Python for this purpose. (Contributed by Zachary |
| 661 | Ware in :issue:`30450`.) |
| 662 | |
xdegaye | 56d1f5c | 2017-10-26 15:09:06 +0200 | [diff] [blame] | 663 | * The ``PyExc_RecursionErrorInst`` singleton that was part of the public API |
| 664 | has been removed as its members being never cleared may cause a segfault |
| 665 | during finalization of the interpreter. Contributed by Xavier de Gaye in |
| 666 | :issue:`22898` and :issue:`30697`. |
| 667 | |
Antoine Pitrou | a6a4dc8 | 2017-09-07 18:56:24 +0200 | [diff] [blame] | 668 | * Support for building ``--without-threads`` is removed. |
| 669 | (Contributed by Antoine Pitrou in :issue:`31370`.). |
| 670 | |
Ned Deily | 4829bc6 | 2016-09-12 17:29:04 -0400 | [diff] [blame] | 671 | |
Nick Coghlan | 5a85167 | 2017-09-08 10:14:16 +1000 | [diff] [blame] | 672 | Other CPython Implementation Changes |
| 673 | ==================================== |
| 674 | |
| 675 | * Trace hooks may now opt out of receiving ``line`` events from the interpreter |
| 676 | by setting the new ``f_trace_lines`` attribute to :const:`False` on the frame |
| 677 | being traced. (Contributed by Nick Coghlan in :issue:`31344`.) |
| 678 | |
| 679 | * Trace hooks may now opt in to receiving ``opcode`` events from the interpreter |
| 680 | by setting the new ``f_trace_opcodes`` attribute to :const:`True` on the frame |
| 681 | being traced. (Contributed by Nick Coghlan in :issue:`31344`.) |
| 682 | |
| 683 | |
Ned Deily | 4829bc6 | 2016-09-12 17:29:04 -0400 | [diff] [blame] | 684 | Deprecated |
| 685 | ========== |
| 686 | |
Serhiy Storchaka | 73a7e9b | 2017-12-01 06:54:17 +0200 | [diff] [blame] | 687 | * Yield expressions (both ``yield`` and ``yield from`` clauses) are now deprecated |
| 688 | in comprehensions and generator expressions (aside from the iterable expression |
| 689 | in the leftmost :keyword:`for` clause). This ensures that comprehensions |
| 690 | always immediately return a container of the appropriate type (rather than |
| 691 | potentially returning a :term:`generator iterator` object), while generator |
| 692 | expressions won't attempt to interleave their implicit output with the output |
| 693 | from any explicit yield expressions. |
| 694 | |
| 695 | In Python 3.7, such expressions emit :exc:`DeprecationWarning` when compiled, |
| 696 | in Python 3.8+ they will emit :exc:`SyntaxError`. (Contributed by Serhiy |
| 697 | Storchaka in :issue:`10544`.) |
| 698 | |
Serhiy Storchaka | 6e08baf | 2017-01-25 13:27:44 +0200 | [diff] [blame] | 699 | - Function :c:func:`PySlice_GetIndicesEx` is deprecated and replaced with |
| 700 | a macro if ``Py_LIMITED_API`` is not set or set to the value between |
| 701 | ``0x03050400`` and ``0x03060000`` (not including) or ``0x03060100`` or |
| 702 | higher. (Contributed by Serhiy Storchaka in :issue:`27867`.) |
Ned Deily | 4829bc6 | 2016-09-12 17:29:04 -0400 | [diff] [blame] | 703 | |
Garvit Khatri | 1cf93a7 | 2017-03-28 23:43:38 +0800 | [diff] [blame] | 704 | - Deprecated :meth:`format` from :mod:`locale`, use the :meth:`format_string` |
| 705 | instead. (Contributed by Garvit in :issue:`10379`.) |
| 706 | |
Matthias Bussonnier | 1d4601c | 2017-02-15 18:00:32 -0800 | [diff] [blame] | 707 | - Methods |
| 708 | :meth:`MetaPathFinder.find_module() <importlib.abc.MetaPathFinder.find_module>` |
| 709 | (replaced by |
| 710 | :meth:`MetaPathFinder.find_spec() <importlib.abc.MetaPathFinder.find_spec>` |
| 711 | ) and |
| 712 | :meth:`PathEntryFinder.find_loader() <importlib.abc.PathEntryFinder.find_loader>` |
| 713 | (replaced by |
| 714 | :meth:`PathEntryFinder.find_spec() <importlib.abc.PathEntryFinder.find_spec>`) |
| 715 | both deprecated in Python 3.4 now emit :exc:`DeprecationWarning`. (Contributed |
| 716 | by Matthias Bussonnier in :issue:`29576`) |
| 717 | |
Serhiy Storchaka | f659598 | 2017-03-12 13:15:01 +0200 | [diff] [blame] | 718 | - Using non-integer value for selecting a plural form in :mod:`gettext` is |
Garvit Khatri | 1cf93a7 | 2017-03-28 23:43:38 +0800 | [diff] [blame] | 719 | now deprecated. It never correctly worked. (Contributed by Serhiy Storchaka |
| 720 | in :issue:`28692`.) |
Serhiy Storchaka | f659598 | 2017-03-12 13:15:01 +0200 | [diff] [blame] | 721 | |
Victor Stinner | 89a1c93 | 2017-05-15 11:01:21 +0200 | [diff] [blame] | 722 | - The :mod:`macpath` is now deprecated and will be removed in Python 3.8. |
| 723 | |
Ned Deily | 4829bc6 | 2016-09-12 17:29:04 -0400 | [diff] [blame] | 724 | |
Serhiy Storchaka | aefa7eb | 2017-03-23 15:48:39 +0200 | [diff] [blame] | 725 | Changes in the C API |
| 726 | -------------------- |
| 727 | |
| 728 | - The type of results of :c:func:`PyThread_start_new_thread` and |
| 729 | :c:func:`PyThread_get_thread_ident`, and the *id* parameter of |
| 730 | :c:func:`PyThreadState_SetAsyncExc` changed from :c:type:`long` to |
| 731 | :c:type:`unsigned long`. |
| 732 | (Contributed by Serhiy Storchaka in :issue:`6532`.) |
| 733 | |
Serhiy Storchaka | e613e6a | 2017-06-27 16:03:14 +0300 | [diff] [blame] | 734 | - :c:func:`PyUnicode_AsWideCharString` now raises a :exc:`ValueError` if the |
| 735 | second argument is *NULL* and the :c:type:`wchar_t*` string contains null |
| 736 | characters. (Contributed by Serhiy Storchaka in :issue:`30708`.) |
| 737 | |
Serhiy Storchaka | aefa7eb | 2017-03-23 15:48:39 +0200 | [diff] [blame] | 738 | |
Steve (Gadget) Barnes | 5b8f972 | 2017-06-28 20:14:52 +0100 | [diff] [blame] | 739 | Windows Only |
| 740 | ------------ |
| 741 | - The python launcher, (py.exe), can accept 32 & 64 bit specifiers **without** |
| 742 | having to specify a minor version as well. So ``py -3-32`` and ``py -3-64`` |
| 743 | become valid as well as ``py -3.7-32``, also the -*m*-64 and -*m.n*-64 forms |
| 744 | are now accepted to force 64 bit python even if 32 bit would have otherwise |
| 745 | been used. If the specified version is not available py.exe will error exit. |
| 746 | (Contributed by Steve Barnes in :issue:`30291`.) |
| 747 | |
| 748 | - The launcher can be run as "py -0" to produce a list of the installed pythons, |
| 749 | *with default marked with an asterix*. Running "py -0p" will include the paths. |
| 750 | If py is run with a version specifier that cannot be matched it will also print |
| 751 | the *short form* list of available specifiers. |
| 752 | (Contributed by Steve Barnes in :issue:`30362`.) |
| 753 | |
Ned Deily | 4829bc6 | 2016-09-12 17:29:04 -0400 | [diff] [blame] | 754 | Removed |
| 755 | ======= |
| 756 | |
Serhiy Storchaka | ff3dbe9 | 2016-12-06 19:25:19 +0200 | [diff] [blame] | 757 | API and Feature Removals |
| 758 | ------------------------ |
| 759 | |
Victor Stinner | 01b5aab | 2017-10-24 02:02:00 -0700 | [diff] [blame] | 760 | * The ``os.stat_float_times()`` function has been removed. It was introduced in |
| 761 | Python 2.3 for backward compatibility with Python 2.2, and was deprecated |
| 762 | since Python 3.1. |
| 763 | |
Serhiy Storchaka | ff3dbe9 | 2016-12-06 19:25:19 +0200 | [diff] [blame] | 764 | * Unknown escapes consisting of ``'\'`` and an ASCII letter in replacement |
Serhiy Storchaka | b2d6179 | 2017-01-13 21:14:40 +0200 | [diff] [blame] | 765 | templates for :func:`re.sub` were deprecated in Python 3.5, and will now |
| 766 | cause an error. |
Ned Deily | 4829bc6 | 2016-09-12 17:29:04 -0400 | [diff] [blame] | 767 | |
Serhiy Storchaka | 4f76fb1 | 2017-01-13 13:25:24 +0200 | [diff] [blame] | 768 | * Removed support of the *exclude* argument in :meth:`tarfile.TarFile.add`. |
Serhiy Storchaka | b2d6179 | 2017-01-13 21:14:40 +0200 | [diff] [blame] | 769 | It was deprecated in Python 2.7 and 3.2. Use the *filter* argument instead. |
Serhiy Storchaka | 4f76fb1 | 2017-01-13 13:25:24 +0200 | [diff] [blame] | 770 | |
Serhiy Storchaka | 9ed707e | 2017-01-13 20:55:05 +0200 | [diff] [blame] | 771 | * The ``splitunc()`` function in the :mod:`ntpath` module was deprecated in |
| 772 | Python 3.1, and has now been removed. Use the :func:`~os.path.splitdrive` |
| 773 | function instead. |
| 774 | |
Raymond Hettinger | 8b57d73 | 2017-09-10 10:23:36 -0700 | [diff] [blame] | 775 | * :func:`collections.namedtuple` no longer supports the *verbose* parameter |
| 776 | or ``_source`` attribute which showed the generated source code for the |
| 777 | named tuple class. This was part of an optimization designed to speed-up |
| 778 | class creation. (Contributed by Jelle Zijlstra with further improvements |
| 779 | by INADA Naoki, Serhiy Storchaka, and Raymond Hettinger in :issue:`28638`.) |
| 780 | |
Serhiy Storchaka | 2e56424 | 2017-03-06 17:01:06 +0200 | [diff] [blame] | 781 | * Functions :func:`bool`, :func:`float`, :func:`list` and :func:`tuple` no |
| 782 | longer take keyword arguments. The first argument of :func:`int` can now |
Daniel Porteous | 77f68e3 | 2017-06-21 10:21:48 +1000 | [diff] [blame] | 783 | be passed only as positional argument. |
Serhiy Storchaka | 2e56424 | 2017-03-06 17:01:06 +0200 | [diff] [blame] | 784 | |
Serhiy Storchaka | edef358 | 2017-05-15 13:21:31 +0300 | [diff] [blame] | 785 | * Removed previously deprecated in Python 2.4 classes ``Plist``, ``Dict`` and |
| 786 | ``_InternalDict`` in the :mod:`plistlib` module. Dict values in the result |
| 787 | of functions :func:`~plistlib.readPlist` and |
| 788 | :func:`~plistlib.readPlistFromBytes` are now normal dicts. You no longer |
| 789 | can use attribute access to access items of these dictionaries. |
| 790 | |
Ned Deily | 4829bc6 | 2016-09-12 17:29:04 -0400 | [diff] [blame] | 791 | |
| 792 | Porting to Python 3.7 |
| 793 | ===================== |
| 794 | |
| 795 | This section lists previously described changes and other bugfixes |
| 796 | that may require changes to your code. |
| 797 | |
| 798 | |
Serhiy Storchaka | 9165f77 | 2017-11-15 08:49:40 +0200 | [diff] [blame] | 799 | Changes in Python behavior |
| 800 | -------------------------- |
| 801 | |
| 802 | * Due to an oversight, earlier Python versions erroneously accepted the |
| 803 | following syntax:: |
| 804 | |
| 805 | f(1 for x in [1],) |
| 806 | |
Serhiy Storchaka | ddbce13 | 2017-11-15 17:39:37 +0200 | [diff] [blame] | 807 | class C(1 for x in [1]): |
| 808 | pass |
| 809 | |
Serhiy Storchaka | 9165f77 | 2017-11-15 08:49:40 +0200 | [diff] [blame] | 810 | Python 3.7 now correctly raises a :exc:`SyntaxError`, as a generator |
| 811 | expression always needs to be directly inside a set of parentheses |
Serhiy Storchaka | ddbce13 | 2017-11-15 17:39:37 +0200 | [diff] [blame] | 812 | and cannot have a comma on either side, and the duplication of the |
| 813 | parentheses can be omitted only on calls. |
| 814 | (Contributed by Serhiy Storchaka in :issue:`32012` and :issue:`32023`.) |
Serhiy Storchaka | 9165f77 | 2017-11-15 08:49:40 +0200 | [diff] [blame] | 815 | |
| 816 | |
Serhiy Storchaka | 009b0a1 | 2017-01-13 09:10:51 +0200 | [diff] [blame] | 817 | Changes in the Python API |
| 818 | ------------------------- |
| 819 | |
Victor Stinner | ac577d7 | 2017-11-28 21:33:20 +0100 | [diff] [blame] | 820 | * The ``asyncio.windows_utils.socketpair()`` function has been |
| 821 | removed: use directly :func:`socket.socketpair` which is available on all |
| 822 | platforms since Python 3.5 (before, it wasn't available on Windows). |
| 823 | ``asyncio.windows_utils.socketpair()`` was just an alias to |
| 824 | ``socket.socketpair`` on Python 3.5 and newer. |
| 825 | |
Victor Stinner | 4271dfd | 2017-11-28 15:19:56 +0100 | [diff] [blame] | 826 | * :mod:`asyncio`: The module doesn't export :mod:`selectors` and |
| 827 | :mod:`_overlapped` modules as ``asyncio.selectors`` and |
| 828 | ``asyncio._overlapped``. Replace ``from asyncio import selectors`` with |
| 829 | ``import selectors`` for example. |
| 830 | |
Sanyam Khurana | b9c3da5 | 2017-06-13 22:41:14 +0530 | [diff] [blame] | 831 | * :meth:`pkgutil.walk_packages` now raises ValueError if *path* is a string. |
| 832 | Previously an empty list was returned. (Contributed by Sanyam Khurana in |
| 833 | :issue:`24744`.) |
| 834 | |
Serhiy Storchaka | 009b0a1 | 2017-01-13 09:10:51 +0200 | [diff] [blame] | 835 | * A format string argument for :meth:`string.Formatter.format` |
| 836 | is now :ref:`positional-only <positional-only_parameter>`. |
Garvit Khatri | 1cf93a7 | 2017-03-28 23:43:38 +0800 | [diff] [blame] | 837 | Passing it as a keyword argument was deprecated in Python 3.5. (Contributed |
| 838 | by Serhiy Storchaka in :issue:`29193`.) |
Serhiy Storchaka | cc28337 | 2017-01-13 09:23:15 +0200 | [diff] [blame] | 839 | |
| 840 | * Attributes :attr:`~http.cookies.Morsel.key`, |
| 841 | :attr:`~http.cookies.Morsel.value` and |
| 842 | :attr:`~http.cookies.Morsel.coded_value` of class |
| 843 | :class:`http.cookies.Morsel` are now read-only. |
Serhiy Storchaka | b2d6179 | 2017-01-13 21:14:40 +0200 | [diff] [blame] | 844 | Assigning to them was deprecated in Python 3.5. |
Serhiy Storchaka | cc28337 | 2017-01-13 09:23:15 +0200 | [diff] [blame] | 845 | Use the :meth:`~http.cookies.Morsel.set` method for setting them. |
| 846 | (Contributed by Serhiy Storchaka in :issue:`29192`.) |
INADA Naoki | 015bce6 | 2017-01-16 17:23:30 +0900 | [diff] [blame] | 847 | |
INADA Naoki | cb41b27 | 2017-02-23 00:31:59 +0900 | [diff] [blame] | 848 | * ``Module``, ``FunctionDef``, ``AsyncFunctionDef``, and |
| 849 | ``ClassDef`` AST nodes now have a new ``docstring`` field. |
| 850 | The first statement in their body is not considered as a docstring |
| 851 | anymore. ``co_firstlineno`` and ``co_lnotab`` of code object for class |
Garvit Khatri | 1cf93a7 | 2017-03-28 23:43:38 +0800 | [diff] [blame] | 852 | and module are affected by this change. (Contributed by INADA Naoki and |
| 853 | Eugene Toder in :issue:`29463`.) |
INADA Naoki | 015bce6 | 2017-01-16 17:23:30 +0900 | [diff] [blame] | 854 | |
Serhiy Storchaka | e304e33 | 2017-03-24 13:27:42 +0200 | [diff] [blame] | 855 | * The *mode* argument of :func:`os.makedirs` no longer affects the file |
| 856 | permission bits of newly-created intermediate-level directories. |
| 857 | To set their file permission bits you can set the umask before invoking |
| 858 | ``makedirs()``. |
| 859 | (Contributed by Serhiy Storchaka in :issue:`19930`.) |
| 860 | |
Victor Stinner | f87b85f | 2017-06-23 15:11:12 +0200 | [diff] [blame] | 861 | * The :attr:`struct.Struct.format` type is now :class:`str` instead of |
| 862 | :class:`bytes`. (Contributed by Victor Stinner in :issue:`21071`.) |
| 863 | |
Segev Finer | 9f3bdcb | 2017-06-28 23:51:00 +0300 | [diff] [blame] | 864 | * Due to internal changes in :mod:`socket` you won't be able to |
| 865 | :func:`socket.fromshare` a socket :func:`~socket.socket.share`-ed in older |
| 866 | Python versions. |
| 867 | |
Utkarsh Upadhyay | 8e45318 | 2017-07-28 14:42:56 +0200 | [diff] [blame] | 868 | * ``repr`` for :class:`datetime.timedelta` has changed to include keyword arguments |
| 869 | in the output. (Contributed by Utkarsh Upadhyay in :issue:`30302`.) |
| 870 | |
Serhiy Storchaka | d4d79bc | 2017-11-04 14:16:35 +0200 | [diff] [blame] | 871 | * Because :func:`shutil.rmtree` is now implemented using the :func:`os.scandir` |
| 872 | function, the user specified handler *onerror* is now called with the first |
| 873 | argument ``os.scandir`` instead of ``os.listdir`` when listing the direcory |
| 874 | is failed. |
| 875 | |
Serhiy Storchaka | 05cb728 | 2017-11-16 12:38:26 +0200 | [diff] [blame] | 876 | * Support of nested sets and set operations in regular expressions as in |
| 877 | `Unicode Technical Standard #18`_ might be added in the future. This would |
| 878 | change the syntax, so to facilitate this change a :exc:`FutureWarning` will |
| 879 | be raised in ambiguous cases for the time being. |
| 880 | That include sets starting with a literal ``'['`` or containing literal |
| 881 | character sequences ``'--'``, ``'&&'``, ``'~~'``, and ``'||'``. To |
| 882 | avoid a warning escape them with a backslash. |
| 883 | (Contributed by Serhiy Storchaka in :issue:`30349`.) |
| 884 | |
Serhiy Storchaka | 70d56fb | 2017-12-04 14:29:05 +0200 | [diff] [blame] | 885 | * The result of splitting a string on a :mod:`regular expression <re>` |
| 886 | that could match an empty string has been changed. For example |
| 887 | splitting on ``r'\s*'`` will now split not only on whitespaces as it |
Serhiy Storchaka | fbb490f | 2018-01-04 11:06:13 +0200 | [diff] [blame] | 888 | did previously, but also on empty strings before all non-whitespace |
| 889 | characters and just before the end of the string. |
| 890 | The previous behavior can be restored by changing the pattern |
Serhiy Storchaka | 70d56fb | 2017-12-04 14:29:05 +0200 | [diff] [blame] | 891 | to ``r'\s+'``. A :exc:`FutureWarning` was emitted for such patterns since |
| 892 | Python 3.5. |
| 893 | |
| 894 | For patterns that match both empty and non-empty strings, the result of |
| 895 | searching for all matches may also be changed in other cases. For example |
| 896 | in the string ``'a\n\n'``, the pattern ``r'(?m)^\s*?$'`` will not only |
| 897 | match empty strings at positions 2 and 3, but also the string ``'\n'`` at |
| 898 | positions 2--3. To match only blank lines, the pattern should be rewritten |
| 899 | as ``r'(?m)^[^\S\n]*$'``. |
| 900 | |
Serhiy Storchaka | fbb490f | 2018-01-04 11:06:13 +0200 | [diff] [blame] | 901 | :func:`re.sub()` now replaces empty matches adjacent to a previous |
| 902 | non-empty match. For example ``re.sub('x*', '-', 'abxd')`` returns now |
| 903 | ``'-a-b--d-'`` instead of ``'-a-b--d-'`` (the first minus between 'b' and |
| 904 | 'd' replaces 'x', and the second minus replaces an empty string between |
| 905 | 'x' and 'd'). |
| 906 | |
| 907 | (Contributed by Serhiy Storchaka in :issue:`25054` and :issue:`32308`.) |
Serhiy Storchaka | 70d56fb | 2017-12-04 14:29:05 +0200 | [diff] [blame] | 908 | |
Jesse-Bakker | 706e10b | 2017-11-30 00:05:07 +0100 | [diff] [blame] | 909 | * :class:`tracemalloc.Traceback` frames are now sorted from oldest to most |
| 910 | recent to be more consistent with :mod:`traceback`. |
| 911 | (Contributed by Jesse Bakker in :issue:`32121`.) |
| 912 | |
Yury Selivanov | 9818142 | 2017-12-18 20:02:54 -0500 | [diff] [blame] | 913 | * On OSes that support :const:`socket.SOCK_NONBLOCK` or |
| 914 | :const:`socket.SOCK_CLOEXEC` bit flags, the |
| 915 | :attr:`socket.type <socket.socket.type>` no longer has them applied. |
| 916 | Therefore, checks like ``if sock.type == socket.SOCK_STREAM`` |
| 917 | work as expected on all platforms. |
| 918 | (Contributed by Yury Selivanov in :issue:`32331`.) |
| 919 | |
Serhiy Storchaka | 05cb728 | 2017-11-16 12:38:26 +0200 | [diff] [blame] | 920 | .. _Unicode Technical Standard #18: https://unicode.org/reports/tr18/ |
| 921 | |
Segev Finer | b2a6083 | 2017-12-18 11:28:19 +0200 | [diff] [blame] | 922 | * On Windows the default for the *close_fds* argument of |
| 923 | :class:`subprocess.Popen` was changed from :const:`False` to :const:`True` |
| 924 | when redirecting the standard handles. If you previously depended on handles |
| 925 | being inherited when using :class:`subprocess.Popen` with standard io |
| 926 | redirection, you will have to pass ``close_fds=False`` to preserve the |
| 927 | previous behaviour, or use |
| 928 | :attr:`STARTUPINFO.lpAttributeList <subprocess.STARTUPINFO.lpAttributeList>`. |
| 929 | |
Serhiy Storchaka | e304e33 | 2017-03-24 13:27:42 +0200 | [diff] [blame] | 930 | |
Serhiy Storchaka | 4d3f084 | 2017-10-08 12:53:34 +0300 | [diff] [blame] | 931 | Changes in the C API |
| 932 | -------------------- |
| 933 | |
| 934 | * The function :c:func:`PySlice_GetIndicesEx` is considered not safe for |
| 935 | resizable sequences. If the slice indices are not instances of :class:`int`, |
| 936 | but objects that implement the :meth:`!__index__` method, the sequence can be |
| 937 | resized after passing its length to :c:func:`!PySlice_GetIndicesEx`. This |
| 938 | can lead to returning indices out of the length of the sequence. For |
| 939 | avoiding possible problems use new functions :c:func:`PySlice_Unpack` and |
| 940 | :c:func:`PySlice_AdjustIndices`. |
| 941 | (Contributed by Serhiy Storchaka in :issue:`27867`.) |
| 942 | |
| 943 | |
INADA Naoki | 015bce6 | 2017-01-16 17:23:30 +0900 | [diff] [blame] | 944 | CPython bytecode changes |
| 945 | ------------------------ |
| 946 | |
Martin Panter | 91a8866 | 2017-01-24 00:30:06 +0000 | [diff] [blame] | 947 | * Added two new opcodes: :opcode:`LOAD_METHOD` and :opcode:`CALL_METHOD`. |
INADA Naoki | 015bce6 | 2017-01-16 17:23:30 +0900 | [diff] [blame] | 948 | (Contributed by Yury Selivanov and INADA Naoki in :issue:`26110`.) |
Julien Palard | 809d173 | 2017-10-24 11:22:22 +0200 | [diff] [blame] | 949 | |
| 950 | |
Nick Coghlan | 1b46131 | 2017-11-05 14:58:45 +1000 | [diff] [blame] | 951 | Other CPython implementation changes |
| 952 | ------------------------------------ |
| 953 | |
| 954 | * In preparation for potential future changes to the public CPython runtime |
| 955 | initialization API (see :pep:`432` for details), CPython's internal startup |
| 956 | and configuration management logic has been significantly refactored. While |
| 957 | these updates are intended to be entirely transparent to both embedding |
| 958 | applications and users of the regular CPython CLI, they're being mentioned |
| 959 | here as the refactoring changes the internal order of various operations |
| 960 | during interpreter startup, and hence may uncover previously latent defects, |
| 961 | either in embedding applications, or in CPython itself. |
| 962 | (Contributed by Nick Coghlan and Eric Snow as part of :issue:`22257`.) |
| 963 | |
Victor Stinner | 747f48e | 2017-12-12 22:59:48 +0100 | [diff] [blame] | 964 | * Due to changes in the way the default warnings filters are configured, |
| 965 | setting ``Py_BytesWarningFlag`` to a value greater than one is no longer |
| 966 | sufficient to both emit ``BytesWarning`` messages and have them converted |
| 967 | to exceptions. Instead, the flag must be set (to cause the warnings to be |
| 968 | emitted in the first place), and an explicit ``error::BytesWarning`` |
| 969 | warnings filter added to convert them to exceptions. |
Nick Coghlan | 1b46131 | 2017-11-05 14:58:45 +1000 | [diff] [blame] | 970 | |
Julien Palard | 809d173 | 2017-10-24 11:22:22 +0200 | [diff] [blame] | 971 | Documentation |
| 972 | ============= |
| 973 | |
| 974 | .. _whatsnew37-pep545: |
| 975 | |
| 976 | PEP 545: Python Documentation Translations |
| 977 | ------------------------------------------ |
| 978 | |
| 979 | :pep:`545` describes the process to translate Python documentation, |
| 980 | and two translations have been added: |
| 981 | |
Berker Peksag | 28ab3ce | 2017-11-08 16:36:58 +0300 | [diff] [blame] | 982 | - Japanese: https://docs.python.org/ja/ and associated GitHub |
Julien Palard | 809d173 | 2017-10-24 11:22:22 +0200 | [diff] [blame] | 983 | repository: https://github.com/python/python-docs-ja |
| 984 | |
Berker Peksag | 28ab3ce | 2017-11-08 16:36:58 +0300 | [diff] [blame] | 985 | - French: https://docs.python.org/fr/ and associated GitHub |
Julien Palard | 809d173 | 2017-10-24 11:22:22 +0200 | [diff] [blame] | 986 | repository: https://github.com/python/python-docs-fr |
| 987 | |
| 988 | (Contributed by Julien Palard, Inada Naoki, and Victor Stinner in |
Berker Peksag | 28ab3ce | 2017-11-08 16:36:58 +0300 | [diff] [blame] | 989 | :issue:`26546`.) |