@@ -75,27 +75,27 @@ New Features
75
75
Other Language Changes
76
76
======================
77
77
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
80
80
its top-level package.
81
81
(Contributed by Ngalim Siregar in :issue: `37444 `.)
82
82
83
83
84
84
* Python now gets the absolute path of the script filename specified on
85
85
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
87
87
absolute path, rather than a relative path. These paths now remain valid
88
88
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.
91
91
(Contributed by Victor Stinner in :issue: `20443 `.)
92
92
93
93
* In development mode and in debug build, *encoding * and *errors * arguments are
94
94
now checked on string encoding and decoding operations. Examples:
95
95
:func: `open `, :meth: `str.encode ` and :meth: `bytes.decode `.
96
96
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
99
99
ignored for empty strings.
100
100
(Contributed by Victor Stinner in :issue: `37388 `.)
101
101
@@ -119,15 +119,16 @@ multiline indented output.
119
119
asyncio
120
120
-------
121
121
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 `.
125
126
(Contributed by Kyle Stanley in :issue: `34037 `.)
126
127
127
128
threading
128
129
---------
129
130
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
131
132
threads were never supported in subinterpreters. Previously, the subinterpreter
132
133
finalization crashed with a Python fatal error if a daemon thread was still
133
134
running.
@@ -164,8 +165,8 @@ Optimizations
164
165
Build and C API Changes
165
166
=======================
166
167
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
169
170
way to call a callable Python object without any argument.
170
171
(Contributed by Victor Stinner in :issue: `37194 `.)
171
172
@@ -176,26 +177,26 @@ Deprecated
176
177
177
178
* Currently :func: `math.factorial ` accepts :class: `float ` instances with
178
179
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
180
181
Python versions it will raise a :exc: `TypeError ` for all floats.
181
182
(Contributed by Serhiy Storchaka in :issue: `37315 `.)
182
183
183
184
* 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
185
186
Tree (AST) generation and compilation stage, using the :mod: `ast ` module.
186
187
187
188
* The :mod: `random ` module currently accepts any hashable type as a
188
189
possible seed value. Unfortunately, some of those types are not
189
190
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 `,
191
192
:class: `float `, :class: `str `, :class: `bytes `, and :class: `bytearray `.
192
193
193
194
194
195
Removed
195
196
=======
196
197
197
198
* 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
199
200
build option ``CALL_PROFILE `` which was already removed in Python 3.7.
200
201
(Contributed by Victor Stinner in :issue: `37414 `.)
201
202
@@ -213,7 +214,7 @@ Removed
213
214
(Contributed by Victor Stinner in :issue: `37312 `.)
214
215
215
216
* ``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
217
218
removed. They were deprecated since Python 3.7.
218
219
(Contributed by Victor Stinner in :issue: `37320 `.)
219
220
@@ -229,16 +230,16 @@ Removed
229
230
(Contributed by Serhiy Storchaka in :issue: `36543 `.)
230
231
231
232
* 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 .
235
236
(Contributed by Jon Janzen in :issue: `36409 `.)
236
237
237
- * ``PyThreadState_DeleteCurrent() `` has been removed. It was not documented.
238
+ * The C function ``PyThreadState_DeleteCurrent() `` has been removed. It was not documented.
238
239
(Contributed by Joannah Nanjekye in :issue: `37878 `.)
239
240
240
241
* 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
242
243
of :pep: `442 `. Patch by Joannah Nanjekye.
243
244
(Contributed by Joannah Nanjekye in :issue: `15088 `)
244
245
@@ -253,11 +254,10 @@ that may require changes to your code.
253
254
Changes in the Python API
254
255
-------------------------
255
256
256
- * :func: `builtins. __import__ ` and :func: `importlib.util.resolve_name ` now raise
257
+ * :func: `__import__ ` and :func: `importlib.util.resolve_name ` now raise
257
258
:exc: `ImportError ` where it previously raised :exc: `ValueError `. Callers
258
259
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): ``.
261
261
262
262
* The :mod: `venv ` activation scripts no longer special-case when
263
263
``__VENV_PROMPT__ `` is set to ``"" ``.
0 commit comments