|
47 | 47 | This article explains the new features in Python 3.8, compared to 3.7.
|
48 | 48 | For full details, see the :ref:`changelog <changelog>`.
|
49 | 49 |
|
50 |
| -Prerelease users should be aware that this document is currently in |
51 |
| -draft form. It will be updated as Python 3.8 moves towards release, so |
52 |
| -it's worth checking back even after reading earlier versions. Some |
53 |
| -notable items not yet covered are: |
54 |
| - |
55 |
| -* :pep:`578` - Runtime audit hooks for potentially sensitive operations |
56 |
| -* ``python -m asyncio`` runs a natively async REPL |
57 |
| - |
58 | 50 | .. testsetup::
|
59 | 51 |
|
60 | 52 | from datetime import date
|
@@ -287,6 +279,18 @@ calculations can be shown::
|
287 | 279 | (Contributed by Eric V. Smith and Larry Hastings in :issue:`36817`.)
|
288 | 280 |
|
289 | 281 |
|
| 282 | +PEP 578: Python Runtime Audit Hooks |
| 283 | +----------------------------------- |
| 284 | + |
| 285 | +The PEP adds an Audit Hook and Verified Open Hook. Both are available from |
| 286 | +Python and native code, allowing applications and frameworks written in pure |
| 287 | +Python code to take advantage of extra notifications, while also allowing |
| 288 | +embedders or system administrators to deploy builds of Python where auditing is |
| 289 | +always enabled. |
| 290 | + |
| 291 | +See :pep:`578` for full details. |
| 292 | + |
| 293 | + |
290 | 294 | PEP 587: Python Initialization Configuration
|
291 | 295 | --------------------------------------------
|
292 | 296 |
|
@@ -584,6 +588,23 @@ The :func:`ast.parse` function has some new flags:
|
584 | 588 | asyncio
|
585 | 589 | -------
|
586 | 590 |
|
| 591 | +Running ``python -m asyncio`` launches a natively async REPL. This allows rapid |
| 592 | +experimentation with code that has a top-level :keyword:`await`. There is no |
| 593 | +longer a need to directly call ``asyncio.run()`` which would spawn a new event |
| 594 | +loop on every invocation: |
| 595 | + |
| 596 | +.. code-block:: none |
| 597 | +
|
| 598 | + $ python -m asyncio |
| 599 | + asyncio REPL 3.8.0 |
| 600 | + Use "await" directly instead of "asyncio.run()". |
| 601 | + Type "help", "copyright", "credits" or "license" for more information. |
| 602 | + >>> import asyncio |
| 603 | + >>> await asyncio.sleep(10, result='hello') |
| 604 | + hello |
| 605 | +
|
| 606 | +(Contributed by Yury Selivanov in :issue:`37028`.) |
| 607 | + |
587 | 608 | On Windows, the default event loop is now :class:`~asyncio.ProactorEventLoop`.
|
588 | 609 | (Contributed by Victor Stinner in :issue:`34687`.)
|
589 | 610 |
|
|
0 commit comments