Skip to content

Commit 6a10d59

Browse files
aerosmatrixise
authored andcommitted
Doc: Several fixes and improvements for 3.9 whatsnew (GH-16375)
1 parent 5d326ab commit 6a10d59

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

Doc/whatsnew/3.9.rst

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -75,27 +75,27 @@ New Features
7575
Other Language Changes
7676
======================
7777

78-
* :func:`builtins.__import__` now raises :exc:`ImportError` instead of
79-
:exc:`ValueError` as used to occur when a relative import went past
78+
* :func:`__import__` now raises :exc:`ImportError` instead of
79+
:exc:`ValueError`, which used to occur when a relative import went past
8080
its top-level package.
8181
(Contributed by Ngalim Siregar in :issue:`37444`.)
8282

8383

8484
* Python now gets the absolute path of the script filename specified on
8585
the command line (ex: ``python3 script.py``): the ``__file__`` attribute of
86-
the ``__main__`` module, ``sys.argv[0]`` and ``sys.path[0]`` become an
86+
the :mod:`__main__` module, ``sys.argv[0]`` and ``sys.path[0]`` become an
8787
absolute path, rather than a relative path. These paths now remain valid
8888
after the current directory is changed by :func:`os.chdir`. As a side effect,
89-
a traceback also displays the absolute path for ``__main__`` module frames in
90-
this case.
89+
a traceback also displays the absolute path for :mod:`__main__` module frames
90+
in this case.
9191
(Contributed by Victor Stinner in :issue:`20443`.)
9292

9393
* In development mode and in debug build, *encoding* and *errors* arguments are
9494
now checked on string encoding and decoding operations. Examples:
9595
:func:`open`, :meth:`str.encode` and :meth:`bytes.decode`.
9696

97-
By default, for best performances, the *errors* argument is only checked at
98-
the first encoding/decoding error, and the *encoding* argument is sometimes
97+
By default, for best performance, the *errors* argument is only checked at
98+
the first encoding/decoding error and the *encoding* argument is sometimes
9999
ignored for empty strings.
100100
(Contributed by Victor Stinner in :issue:`37388`.)
101101

@@ -119,15 +119,16 @@ multiline indented output.
119119
asyncio
120120
-------
121121

122-
Added a new couroutine :meth:`loop.shutdown_default_executor` that schedules
123-
a shutdown for the default executor that waits on the threadpool to finish
124-
closing. Also, :func:`asyncio.run` has been updated to use the new coroutine.
122+
Added a new :term:`coroutine` :meth:`~asyncio.loop.shutdown_default_executor`
123+
that schedules a shutdown for the default executor that waits on the
124+
:class:`~concurrent.futures.ThreadPoolExecutor` to finish closing. Also,
125+
:func:`asyncio.run` has been updated to use the new :term:`coroutine`.
125126
(Contributed by Kyle Stanley in :issue:`34037`.)
126127

127128
threading
128129
---------
129130

130-
In a subinterpreter, spawning a daemon thread now raises an exception. Daemon
131+
In a subinterpreter, spawning a daemon thread now raises a :exc:`RuntimeError`. Daemon
131132
threads were never supported in subinterpreters. Previously, the subinterpreter
132133
finalization crashed with a Python fatal error if a daemon thread was still
133134
running.
@@ -164,8 +165,8 @@ Optimizations
164165
Build and C API Changes
165166
=======================
166167

167-
* Add a new public :c:func:`PyObject_CallNoArgs` function to the C API:
168-
call a callable Python object without any arguments. It is the most efficient
168+
* Add a new public :c:func:`PyObject_CallNoArgs` function to the C API, which
169+
calls a callable Python object without any arguments. It is the most efficient
169170
way to call a callable Python object without any argument.
170171
(Contributed by Victor Stinner in :issue:`37194`.)
171172

@@ -176,26 +177,26 @@ Deprecated
176177

177178
* Currently :func:`math.factorial` accepts :class:`float` instances with
178179
non-negative integer values (like ``5.0``). It raises a :exc:`ValueError`
179-
for non-integral and negative floats. It is deprecated now. In future
180+
for non-integral and negative floats. It is now deprecated. In future
180181
Python versions it will raise a :exc:`TypeError` for all floats.
181182
(Contributed by Serhiy Storchaka in :issue:`37315`.)
182183

183184
* The :mod:`parser` module is deprecated and will be removed in future versions
184-
of Python. For the majority of use cases users can leverage the Abstract Syntax
185+
of Python. For the majority of use cases, users can leverage the Abstract Syntax
185186
Tree (AST) generation and compilation stage, using the :mod:`ast` module.
186187

187188
* The :mod:`random` module currently accepts any hashable type as a
188189
possible seed value. Unfortunately, some of those types are not
189190
guaranteed to have a deterministic hash value. After Python 3.9,
190-
the module will restrict its seeds to *None*, :class:`int`,
191+
the module will restrict its seeds to :const:`None`, :class:`int`,
191192
:class:`float`, :class:`str`, :class:`bytes`, and :class:`bytearray`.
192193

193194

194195
Removed
195196
=======
196197

197198
* The undocumented ``sys.callstats()`` function has been removed. Since Python
198-
3.7, it was deprecated and always returned ``None``. It required a special
199+
3.7, it was deprecated and always returned :const:`None`. It required a special
199200
build option ``CALL_PROFILE`` which was already removed in Python 3.7.
200201
(Contributed by Victor Stinner in :issue:`37414`.)
201202

@@ -213,7 +214,7 @@ Removed
213214
(Contributed by Victor Stinner in :issue:`37312`.)
214215

215216
* ``aifc.openfp()`` alias to ``aifc.open()``, ``sunau.openfp()`` alias to
216-
``sunau.open()``, and ``wave.openfp()`` alias to ``wave.open()`` have been
217+
``sunau.open()``, and ``wave.openfp()`` alias to :func:`wave.open()` have been
217218
removed. They were deprecated since Python 3.7.
218219
(Contributed by Victor Stinner in :issue:`37320`.)
219220

@@ -229,16 +230,16 @@ Removed
229230
(Contributed by Serhiy Storchaka in :issue:`36543`.)
230231

231232
* The old :mod:`plistlib` API has been removed, it was deprecated since Python
232-
3.4. Use the :func:`load`, :func:`loads`, :func:`dump`, and :func:`dumps`
233-
functions. Additionally, the ``use_builtin_types`` parameter was removed,
234-
standard :class:`bytes` objects are always used.
233+
3.4. Use the :func:`~plistlib.load`, :func:`~plistlib.loads`, :func:`~plistlib.dump`, and
234+
:func:`~plistlib.dumps` functions. Additionally, the *use_builtin_types* parameter was
235+
removed, standard :class:`bytes` objects are always used instead.
235236
(Contributed by Jon Janzen in :issue:`36409`.)
236237

237-
* ``PyThreadState_DeleteCurrent()`` has been removed. It was not documented.
238+
* The C function ``PyThreadState_DeleteCurrent()`` has been removed. It was not documented.
238239
(Contributed by Joannah Nanjekye in :issue:`37878`.)
239240

240241
* The C function ``PyGen_NeedsFinalizing`` has been removed. It was not
241-
documented, tested or used anywhere within CPython after the implementation
242+
documented, tested, or used anywhere within CPython after the implementation
242243
of :pep:`442`. Patch by Joannah Nanjekye.
243244
(Contributed by Joannah Nanjekye in :issue:`15088`)
244245

@@ -253,11 +254,10 @@ that may require changes to your code.
253254
Changes in the Python API
254255
-------------------------
255256

256-
* :func:`builtins.__import__` and :func:`importlib.util.resolve_name` now raise
257+
* :func:`__import__` and :func:`importlib.util.resolve_name` now raise
257258
:exc:`ImportError` where it previously raised :exc:`ValueError`. Callers
258259
catching the specific exception type and supporting both Python 3.9 and
259-
earlier versions will need to catch both:
260-
``except (ImportError, ValueError):``
260+
earlier versions will need to catch both using ``except (ImportError, ValueError):``.
261261

262262
* The :mod:`venv` activation scripts no longer special-case when
263263
``__VENV_PROMPT__`` is set to ``""``.

0 commit comments

Comments
 (0)