mirror of
https://github.com/python/cpython.git
synced 2025-08-10 03:49:18 +00:00
[3.12] gh-110631: fix wrong indentation in the Doc/whatsnew
dir (GH-110632) (#110690)
fix wrong indentation in the `Doc/whatsnew` dir (#110632)
This commit is contained in:
parent
ca971d12ed
commit
1ea4cb1a66
6 changed files with 191 additions and 191 deletions
|
@ -875,11 +875,11 @@ The signature of the new function is::
|
||||||
|
|
||||||
The parameters are:
|
The parameters are:
|
||||||
|
|
||||||
* *args*: positional arguments whose values will be printed out.
|
* *args*: positional arguments whose values will be printed out.
|
||||||
* *sep*: the separator, which will be printed between arguments.
|
* *sep*: the separator, which will be printed between arguments.
|
||||||
* *end*: the ending text, which will be printed after all of the
|
* *end*: the ending text, which will be printed after all of the
|
||||||
arguments have been output.
|
arguments have been output.
|
||||||
* *file*: the file object to which the output will be sent.
|
* *file*: the file object to which the output will be sent.
|
||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
|
@ -1138,13 +1138,13 @@ indicate that the external caller is done.
|
||||||
The *flags* argument to :c:func:`PyObject_GetBuffer` specifies
|
The *flags* argument to :c:func:`PyObject_GetBuffer` specifies
|
||||||
constraints upon the memory returned. Some examples are:
|
constraints upon the memory returned. Some examples are:
|
||||||
|
|
||||||
* :c:macro:`PyBUF_WRITABLE` indicates that the memory must be writable.
|
* :c:macro:`PyBUF_WRITABLE` indicates that the memory must be writable.
|
||||||
|
|
||||||
* :c:macro:`PyBUF_LOCK` requests a read-only or exclusive lock on the memory.
|
* :c:macro:`PyBUF_LOCK` requests a read-only or exclusive lock on the memory.
|
||||||
|
|
||||||
* :c:macro:`PyBUF_C_CONTIGUOUS` and :c:macro:`PyBUF_F_CONTIGUOUS`
|
* :c:macro:`PyBUF_C_CONTIGUOUS` and :c:macro:`PyBUF_F_CONTIGUOUS`
|
||||||
requests a C-contiguous (last dimension varies the fastest) or
|
requests a C-contiguous (last dimension varies the fastest) or
|
||||||
Fortran-contiguous (first dimension varies the fastest) array layout.
|
Fortran-contiguous (first dimension varies the fastest) array layout.
|
||||||
|
|
||||||
Two new argument codes for :c:func:`PyArg_ParseTuple`,
|
Two new argument codes for :c:func:`PyArg_ParseTuple`,
|
||||||
``s*`` and ``z*``, return locked buffer objects for a parameter.
|
``s*`` and ``z*``, return locked buffer objects for a parameter.
|
||||||
|
|
|
@ -2368,7 +2368,7 @@ Port-Specific Changes: Mac OS X
|
||||||
installation and a user-installed copy of the same version.
|
installation and a user-installed copy of the same version.
|
||||||
(Changed by Ronald Oussoren; :issue:`4865`.)
|
(Changed by Ronald Oussoren; :issue:`4865`.)
|
||||||
|
|
||||||
.. versionchanged:: 2.7.13
|
.. versionchanged:: 2.7.13
|
||||||
|
|
||||||
As of 2.7.13, this change was removed.
|
As of 2.7.13, this change was removed.
|
||||||
``/Library/Python/2.7/site-packages``, the site-packages directory
|
``/Library/Python/2.7/site-packages``, the site-packages directory
|
||||||
|
|
|
@ -221,116 +221,116 @@ have been incorporated. Some of the most notable ones are as follows:
|
||||||
|
|
||||||
* Missing ``:`` before blocks:
|
* Missing ``:`` before blocks:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
>>> if rocket.position > event_horizon
|
>>> if rocket.position > event_horizon
|
||||||
File "<stdin>", line 1
|
File "<stdin>", line 1
|
||||||
if rocket.position > event_horizon
|
if rocket.position > event_horizon
|
||||||
^
|
^
|
||||||
SyntaxError: expected ':'
|
SyntaxError: expected ':'
|
||||||
|
|
||||||
(Contributed by Pablo Galindo in :issue:`42997`.)
|
(Contributed by Pablo Galindo in :issue:`42997`.)
|
||||||
|
|
||||||
* Unparenthesised tuples in comprehensions targets:
|
* Unparenthesised tuples in comprehensions targets:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
>>> {x,y for x,y in zip('abcd', '1234')}
|
>>> {x,y for x,y in zip('abcd', '1234')}
|
||||||
File "<stdin>", line 1
|
File "<stdin>", line 1
|
||||||
{x,y for x,y in zip('abcd', '1234')}
|
{x,y for x,y in zip('abcd', '1234')}
|
||||||
^
|
^
|
||||||
SyntaxError: did you forget parentheses around the comprehension target?
|
SyntaxError: did you forget parentheses around the comprehension target?
|
||||||
|
|
||||||
(Contributed by Pablo Galindo in :issue:`43017`.)
|
(Contributed by Pablo Galindo in :issue:`43017`.)
|
||||||
|
|
||||||
* Missing commas in collection literals and between expressions:
|
* Missing commas in collection literals and between expressions:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
>>> items = {
|
>>> items = {
|
||||||
... x: 1,
|
... x: 1,
|
||||||
... y: 2
|
... y: 2
|
||||||
... z: 3,
|
... z: 3,
|
||||||
File "<stdin>", line 3
|
File "<stdin>", line 3
|
||||||
y: 2
|
y: 2
|
||||||
^
|
^
|
||||||
SyntaxError: invalid syntax. Perhaps you forgot a comma?
|
SyntaxError: invalid syntax. Perhaps you forgot a comma?
|
||||||
|
|
||||||
(Contributed by Pablo Galindo in :issue:`43822`.)
|
(Contributed by Pablo Galindo in :issue:`43822`.)
|
||||||
|
|
||||||
* Multiple Exception types without parentheses:
|
* Multiple Exception types without parentheses:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
>>> try:
|
>>> try:
|
||||||
... build_dyson_sphere()
|
... build_dyson_sphere()
|
||||||
... except NotEnoughScienceError, NotEnoughResourcesError:
|
... except NotEnoughScienceError, NotEnoughResourcesError:
|
||||||
File "<stdin>", line 3
|
File "<stdin>", line 3
|
||||||
except NotEnoughScienceError, NotEnoughResourcesError:
|
except NotEnoughScienceError, NotEnoughResourcesError:
|
||||||
^
|
^
|
||||||
SyntaxError: multiple exception types must be parenthesized
|
SyntaxError: multiple exception types must be parenthesized
|
||||||
|
|
||||||
(Contributed by Pablo Galindo in :issue:`43149`.)
|
(Contributed by Pablo Galindo in :issue:`43149`.)
|
||||||
|
|
||||||
* Missing ``:`` and values in dictionary literals:
|
* Missing ``:`` and values in dictionary literals:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
>>> values = {
|
>>> values = {
|
||||||
... x: 1,
|
... x: 1,
|
||||||
... y: 2,
|
... y: 2,
|
||||||
... z:
|
... z:
|
||||||
... }
|
... }
|
||||||
File "<stdin>", line 4
|
File "<stdin>", line 4
|
||||||
z:
|
z:
|
||||||
^
|
^
|
||||||
SyntaxError: expression expected after dictionary key and ':'
|
SyntaxError: expression expected after dictionary key and ':'
|
||||||
|
|
||||||
>>> values = {x:1, y:2, z w:3}
|
>>> values = {x:1, y:2, z w:3}
|
||||||
File "<stdin>", line 1
|
File "<stdin>", line 1
|
||||||
values = {x:1, y:2, z w:3}
|
values = {x:1, y:2, z w:3}
|
||||||
^
|
^
|
||||||
SyntaxError: ':' expected after dictionary key
|
SyntaxError: ':' expected after dictionary key
|
||||||
|
|
||||||
(Contributed by Pablo Galindo in :issue:`43823`.)
|
(Contributed by Pablo Galindo in :issue:`43823`.)
|
||||||
|
|
||||||
* ``try`` blocks without ``except`` or ``finally`` blocks:
|
* ``try`` blocks without ``except`` or ``finally`` blocks:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
>>> try:
|
>>> try:
|
||||||
... x = 2
|
... x = 2
|
||||||
... something = 3
|
... something = 3
|
||||||
File "<stdin>", line 3
|
File "<stdin>", line 3
|
||||||
something = 3
|
something = 3
|
||||||
^^^^^^^^^
|
^^^^^^^^^
|
||||||
SyntaxError: expected 'except' or 'finally' block
|
SyntaxError: expected 'except' or 'finally' block
|
||||||
|
|
||||||
(Contributed by Pablo Galindo in :issue:`44305`.)
|
(Contributed by Pablo Galindo in :issue:`44305`.)
|
||||||
|
|
||||||
* Usage of ``=`` instead of ``==`` in comparisons:
|
* Usage of ``=`` instead of ``==`` in comparisons:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
>>> if rocket.position = event_horizon:
|
>>> if rocket.position = event_horizon:
|
||||||
File "<stdin>", line 1
|
File "<stdin>", line 1
|
||||||
if rocket.position = event_horizon:
|
if rocket.position = event_horizon:
|
||||||
^
|
^
|
||||||
SyntaxError: cannot assign to attribute here. Maybe you meant '==' instead of '='?
|
SyntaxError: cannot assign to attribute here. Maybe you meant '==' instead of '='?
|
||||||
|
|
||||||
(Contributed by Pablo Galindo in :issue:`43797`.)
|
(Contributed by Pablo Galindo in :issue:`43797`.)
|
||||||
|
|
||||||
* Usage of ``*`` in f-strings:
|
* Usage of ``*`` in f-strings:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
>>> f"Black holes {*all_black_holes} and revelations"
|
>>> f"Black holes {*all_black_holes} and revelations"
|
||||||
File "<stdin>", line 1
|
File "<stdin>", line 1
|
||||||
(*all_black_holes)
|
(*all_black_holes)
|
||||||
^
|
^
|
||||||
SyntaxError: f-string: cannot use starred expression here
|
SyntaxError: f-string: cannot use starred expression here
|
||||||
|
|
||||||
(Contributed by Pablo Galindo in :issue:`41064`.)
|
(Contributed by Pablo Galindo in :issue:`41064`.)
|
||||||
|
|
||||||
IndentationErrors
|
IndentationErrors
|
||||||
~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~
|
||||||
|
@ -365,10 +365,10 @@ raised from:
|
||||||
|
|
||||||
(Contributed by Pablo Galindo in :issue:`38530`.)
|
(Contributed by Pablo Galindo in :issue:`38530`.)
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
Notice this won't work if :c:func:`PyErr_Display` is not called to display the error
|
Notice this won't work if :c:func:`PyErr_Display` is not called to display the error
|
||||||
which can happen if some other custom error display function is used. This is a common
|
which can happen if some other custom error display function is used. This is a common
|
||||||
scenario in some REPLs like IPython.
|
scenario in some REPLs like IPython.
|
||||||
|
|
||||||
NameErrors
|
NameErrors
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
|
@ -387,10 +387,10 @@ was raised from:
|
||||||
|
|
||||||
(Contributed by Pablo Galindo in :issue:`38530`.)
|
(Contributed by Pablo Galindo in :issue:`38530`.)
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
Notice this won't work if :c:func:`PyErr_Display` is not called to display the error,
|
Notice this won't work if :c:func:`PyErr_Display` is not called to display the error,
|
||||||
which can happen if some other custom error display function is used. This is a common
|
which can happen if some other custom error display function is used. This is a common
|
||||||
scenario in some REPLs like IPython.
|
scenario in some REPLs like IPython.
|
||||||
|
|
||||||
|
|
||||||
PEP 626: Precise line numbers for debugging and other tools
|
PEP 626: Precise line numbers for debugging and other tools
|
||||||
|
@ -433,16 +433,16 @@ A match statement takes an expression and compares its value to successive
|
||||||
patterns given as one or more case blocks. Specifically, pattern matching
|
patterns given as one or more case blocks. Specifically, pattern matching
|
||||||
operates by:
|
operates by:
|
||||||
|
|
||||||
1. using data with type and shape (the ``subject``)
|
1. using data with type and shape (the ``subject``)
|
||||||
2. evaluating the ``subject`` in the ``match`` statement
|
2. evaluating the ``subject`` in the ``match`` statement
|
||||||
3. comparing the subject with each pattern in a ``case`` statement
|
3. comparing the subject with each pattern in a ``case`` statement
|
||||||
from top to bottom until a match is confirmed.
|
from top to bottom until a match is confirmed.
|
||||||
4. executing the action associated with the pattern of the confirmed
|
4. executing the action associated with the pattern of the confirmed
|
||||||
match
|
match
|
||||||
5. If an exact match is not confirmed, the last case, a wildcard ``_``,
|
5. If an exact match is not confirmed, the last case, a wildcard ``_``,
|
||||||
if provided, will be used as the matching case. If an exact match is
|
if provided, will be used as the matching case. If an exact match is
|
||||||
not confirmed and a wildcard case does not exist, the entire match
|
not confirmed and a wildcard case does not exist, the entire match
|
||||||
block is a no-op.
|
block is a no-op.
|
||||||
|
|
||||||
Declarative approach
|
Declarative approach
|
||||||
~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~
|
||||||
|
@ -2211,16 +2211,16 @@ Removed
|
||||||
* Removed ``Py_UNICODE_str*`` functions manipulating ``Py_UNICODE*`` strings.
|
* Removed ``Py_UNICODE_str*`` functions manipulating ``Py_UNICODE*`` strings.
|
||||||
(Contributed by Inada Naoki in :issue:`41123`.)
|
(Contributed by Inada Naoki in :issue:`41123`.)
|
||||||
|
|
||||||
* ``Py_UNICODE_strlen``: use :c:func:`PyUnicode_GetLength` or
|
* ``Py_UNICODE_strlen``: use :c:func:`PyUnicode_GetLength` or
|
||||||
:c:macro:`PyUnicode_GET_LENGTH`
|
:c:macro:`PyUnicode_GET_LENGTH`
|
||||||
* ``Py_UNICODE_strcat``: use :c:func:`PyUnicode_CopyCharacters` or
|
* ``Py_UNICODE_strcat``: use :c:func:`PyUnicode_CopyCharacters` or
|
||||||
:c:func:`PyUnicode_FromFormat`
|
:c:func:`PyUnicode_FromFormat`
|
||||||
* ``Py_UNICODE_strcpy``, ``Py_UNICODE_strncpy``: use
|
* ``Py_UNICODE_strcpy``, ``Py_UNICODE_strncpy``: use
|
||||||
:c:func:`PyUnicode_CopyCharacters` or :c:func:`PyUnicode_Substring`
|
:c:func:`PyUnicode_CopyCharacters` or :c:func:`PyUnicode_Substring`
|
||||||
* ``Py_UNICODE_strcmp``: use :c:func:`PyUnicode_Compare`
|
* ``Py_UNICODE_strcmp``: use :c:func:`PyUnicode_Compare`
|
||||||
* ``Py_UNICODE_strncmp``: use :c:func:`PyUnicode_Tailmatch`
|
* ``Py_UNICODE_strncmp``: use :c:func:`PyUnicode_Tailmatch`
|
||||||
* ``Py_UNICODE_strchr``, ``Py_UNICODE_strrchr``: use
|
* ``Py_UNICODE_strchr``, ``Py_UNICODE_strrchr``: use
|
||||||
:c:func:`PyUnicode_FindChar`
|
:c:func:`PyUnicode_FindChar`
|
||||||
|
|
||||||
* Removed ``PyUnicode_GetMax()``. Please migrate to new (:pep:`393`) APIs.
|
* Removed ``PyUnicode_GetMax()``. Please migrate to new (:pep:`393`) APIs.
|
||||||
(Contributed by Inada Naoki in :issue:`41103`.)
|
(Contributed by Inada Naoki in :issue:`41103`.)
|
||||||
|
|
|
@ -2399,15 +2399,15 @@ Removed
|
||||||
|
|
||||||
* Legacy Unicode APIs have been removed. See :pep:`623` for detail.
|
* Legacy Unicode APIs have been removed. See :pep:`623` for detail.
|
||||||
|
|
||||||
* :c:macro:`!PyUnicode_WCHAR_KIND`
|
* :c:macro:`!PyUnicode_WCHAR_KIND`
|
||||||
* :c:func:`!PyUnicode_AS_UNICODE`
|
* :c:func:`!PyUnicode_AS_UNICODE`
|
||||||
* :c:func:`!PyUnicode_AsUnicode`
|
* :c:func:`!PyUnicode_AsUnicode`
|
||||||
* :c:func:`!PyUnicode_AsUnicodeAndSize`
|
* :c:func:`!PyUnicode_AsUnicodeAndSize`
|
||||||
* :c:func:`!PyUnicode_AS_DATA`
|
* :c:func:`!PyUnicode_AS_DATA`
|
||||||
* :c:func:`!PyUnicode_FromUnicode`
|
* :c:func:`!PyUnicode_FromUnicode`
|
||||||
* :c:func:`!PyUnicode_GET_SIZE`
|
* :c:func:`!PyUnicode_GET_SIZE`
|
||||||
* :c:func:`!PyUnicode_GetSize`
|
* :c:func:`!PyUnicode_GetSize`
|
||||||
* :c:func:`!PyUnicode_GET_DATA_SIZE`
|
* :c:func:`!PyUnicode_GET_DATA_SIZE`
|
||||||
|
|
||||||
* Remove the ``PyUnicode_InternImmortal()`` function macro.
|
* Remove the ``PyUnicode_InternImmortal()`` function macro.
|
||||||
(Contributed by Victor Stinner in :gh:`85858`.)
|
(Contributed by Victor Stinner in :gh:`85858`.)
|
||||||
|
|
|
@ -917,12 +917,12 @@ abstract methods. The recommended approach to declaring abstract descriptors is
|
||||||
now to provide :attr:`__isabstractmethod__` as a dynamically updated
|
now to provide :attr:`__isabstractmethod__` as a dynamically updated
|
||||||
property. The built-in descriptors have been updated accordingly.
|
property. The built-in descriptors have been updated accordingly.
|
||||||
|
|
||||||
* :class:`abc.abstractproperty` has been deprecated, use :class:`property`
|
* :class:`abc.abstractproperty` has been deprecated, use :class:`property`
|
||||||
with :func:`abc.abstractmethod` instead.
|
with :func:`abc.abstractmethod` instead.
|
||||||
* :class:`abc.abstractclassmethod` has been deprecated, use
|
* :class:`abc.abstractclassmethod` has been deprecated, use
|
||||||
:class:`classmethod` with :func:`abc.abstractmethod` instead.
|
:class:`classmethod` with :func:`abc.abstractmethod` instead.
|
||||||
* :class:`abc.abstractstaticmethod` has been deprecated, use
|
* :class:`abc.abstractstaticmethod` has been deprecated, use
|
||||||
:class:`staticmethod` with :func:`abc.abstractmethod` instead.
|
:class:`staticmethod` with :func:`abc.abstractmethod` instead.
|
||||||
|
|
||||||
(Contributed by Darren Dale in :issue:`11610`.)
|
(Contributed by Darren Dale in :issue:`11610`.)
|
||||||
|
|
||||||
|
@ -1060,32 +1060,32 @@ function to the :mod:`crypt` module.
|
||||||
curses
|
curses
|
||||||
------
|
------
|
||||||
|
|
||||||
* If the :mod:`curses` module is linked to the ncursesw library, use Unicode
|
* If the :mod:`curses` module is linked to the ncursesw library, use Unicode
|
||||||
functions when Unicode strings or characters are passed (e.g.
|
functions when Unicode strings or characters are passed (e.g.
|
||||||
:c:func:`waddwstr`), and bytes functions otherwise (e.g. :c:func:`waddstr`).
|
:c:func:`waddwstr`), and bytes functions otherwise (e.g. :c:func:`waddstr`).
|
||||||
* Use the locale encoding instead of ``utf-8`` to encode Unicode strings.
|
* Use the locale encoding instead of ``utf-8`` to encode Unicode strings.
|
||||||
* :class:`curses.window` has a new :attr:`curses.window.encoding` attribute.
|
* :class:`curses.window` has a new :attr:`curses.window.encoding` attribute.
|
||||||
* The :class:`curses.window` class has a new :meth:`~curses.window.get_wch`
|
* The :class:`curses.window` class has a new :meth:`~curses.window.get_wch`
|
||||||
method to get a wide character
|
method to get a wide character
|
||||||
* The :mod:`curses` module has a new :meth:`~curses.unget_wch` function to
|
* The :mod:`curses` module has a new :meth:`~curses.unget_wch` function to
|
||||||
push a wide character so the next :meth:`~curses.window.get_wch` will return
|
push a wide character so the next :meth:`~curses.window.get_wch` will return
|
||||||
it
|
it
|
||||||
|
|
||||||
(Contributed by Iñigo Serna in :issue:`6755`.)
|
(Contributed by Iñigo Serna in :issue:`6755`.)
|
||||||
|
|
||||||
datetime
|
datetime
|
||||||
--------
|
--------
|
||||||
|
|
||||||
* Equality comparisons between naive and aware :class:`~datetime.datetime`
|
* Equality comparisons between naive and aware :class:`~datetime.datetime`
|
||||||
instances now return :const:`False` instead of raising :exc:`TypeError`
|
instances now return :const:`False` instead of raising :exc:`TypeError`
|
||||||
(:issue:`15006`).
|
(:issue:`15006`).
|
||||||
* New :meth:`datetime.datetime.timestamp` method: Return POSIX timestamp
|
* New :meth:`datetime.datetime.timestamp` method: Return POSIX timestamp
|
||||||
corresponding to the :class:`~datetime.datetime` instance.
|
corresponding to the :class:`~datetime.datetime` instance.
|
||||||
* The :meth:`datetime.datetime.strftime` method supports formatting years
|
* The :meth:`datetime.datetime.strftime` method supports formatting years
|
||||||
older than 1000.
|
older than 1000.
|
||||||
* The :meth:`datetime.datetime.astimezone` method can now be
|
* The :meth:`datetime.datetime.astimezone` method can now be
|
||||||
called without arguments to convert datetime instance to the system
|
called without arguments to convert datetime instance to the system
|
||||||
timezone.
|
timezone.
|
||||||
|
|
||||||
|
|
||||||
.. _new-decimal:
|
.. _new-decimal:
|
||||||
|
@ -1210,25 +1210,25 @@ the ``Message`` object it is serializing. The default policy is
|
||||||
|
|
||||||
The minimum set of controls implemented by all ``policy`` objects are:
|
The minimum set of controls implemented by all ``policy`` objects are:
|
||||||
|
|
||||||
.. tabularcolumns:: |l|L|
|
.. tabularcolumns:: |l|L|
|
||||||
|
|
||||||
=============== =======================================================
|
=============== =======================================================
|
||||||
max_line_length The maximum length, excluding the linesep character(s),
|
max_line_length The maximum length, excluding the linesep character(s),
|
||||||
individual lines may have when a ``Message`` is
|
individual lines may have when a ``Message`` is
|
||||||
serialized. Defaults to 78.
|
serialized. Defaults to 78.
|
||||||
|
|
||||||
linesep The character used to separate individual lines when a
|
linesep The character used to separate individual lines when a
|
||||||
``Message`` is serialized. Defaults to ``\n``.
|
``Message`` is serialized. Defaults to ``\n``.
|
||||||
|
|
||||||
cte_type ``7bit`` or ``8bit``. ``8bit`` applies only to a
|
cte_type ``7bit`` or ``8bit``. ``8bit`` applies only to a
|
||||||
``Bytes`` ``generator``, and means that non-ASCII may
|
``Bytes`` ``generator``, and means that non-ASCII may
|
||||||
be used where allowed by the protocol (or where it
|
be used where allowed by the protocol (or where it
|
||||||
exists in the original input).
|
exists in the original input).
|
||||||
|
|
||||||
raise_on_defect Causes a ``parser`` to raise error when defects are
|
raise_on_defect Causes a ``parser`` to raise error when defects are
|
||||||
encountered instead of adding them to the ``Message``
|
encountered instead of adding them to the ``Message``
|
||||||
object's ``defects`` list.
|
object's ``defects`` list.
|
||||||
=============== =======================================================
|
=============== =======================================================
|
||||||
|
|
||||||
A new policy instance, with new settings, is created using the
|
A new policy instance, with new settings, is created using the
|
||||||
:meth:`~email.policy.Policy.clone` method of policy objects. ``clone`` takes
|
:meth:`~email.policy.Policy.clone` method of policy objects. ``clone`` takes
|
||||||
|
@ -1263,21 +1263,21 @@ removal of the code) may occur if deemed necessary by the core developers.
|
||||||
The new policies are instances of :class:`~email.policy.EmailPolicy`,
|
The new policies are instances of :class:`~email.policy.EmailPolicy`,
|
||||||
and add the following additional controls:
|
and add the following additional controls:
|
||||||
|
|
||||||
.. tabularcolumns:: |l|L|
|
.. tabularcolumns:: |l|L|
|
||||||
|
|
||||||
=============== =======================================================
|
=============== =======================================================
|
||||||
refold_source Controls whether or not headers parsed by a
|
refold_source Controls whether or not headers parsed by a
|
||||||
:mod:`~email.parser` are refolded by the
|
:mod:`~email.parser` are refolded by the
|
||||||
:mod:`~email.generator`. It can be ``none``, ``long``,
|
:mod:`~email.generator`. It can be ``none``, ``long``,
|
||||||
or ``all``. The default is ``long``, which means that
|
or ``all``. The default is ``long``, which means that
|
||||||
source headers with a line longer than
|
source headers with a line longer than
|
||||||
``max_line_length`` get refolded. ``none`` means no
|
``max_line_length`` get refolded. ``none`` means no
|
||||||
line get refolded, and ``all`` means that all lines
|
line get refolded, and ``all`` means that all lines
|
||||||
get refolded.
|
get refolded.
|
||||||
|
|
||||||
header_factory A callable that take a ``name`` and ``value`` and
|
header_factory A callable that take a ``name`` and ``value`` and
|
||||||
produces a custom header object.
|
produces a custom header object.
|
||||||
=============== =======================================================
|
=============== =======================================================
|
||||||
|
|
||||||
The ``header_factory`` is the key to the new features provided by the new
|
The ``header_factory`` is the key to the new features provided by the new
|
||||||
policies. When one of the new policies is used, any header retrieved from
|
policies. When one of the new policies is used, any header retrieved from
|
||||||
|
@ -1352,18 +1352,18 @@ API.
|
||||||
|
|
||||||
New utility functions:
|
New utility functions:
|
||||||
|
|
||||||
* :func:`~email.utils.format_datetime`: given a :class:`~datetime.datetime`,
|
* :func:`~email.utils.format_datetime`: given a :class:`~datetime.datetime`,
|
||||||
produce a string formatted for use in an email header.
|
produce a string formatted for use in an email header.
|
||||||
|
|
||||||
* :func:`~email.utils.parsedate_to_datetime`: given a date string from
|
* :func:`~email.utils.parsedate_to_datetime`: given a date string from
|
||||||
an email header, convert it into an aware :class:`~datetime.datetime`,
|
an email header, convert it into an aware :class:`~datetime.datetime`,
|
||||||
or a naive :class:`~datetime.datetime` if the offset is ``-0000``.
|
or a naive :class:`~datetime.datetime` if the offset is ``-0000``.
|
||||||
|
|
||||||
* :func:`~email.utils.localtime`: With no argument, returns the
|
* :func:`~email.utils.localtime`: With no argument, returns the
|
||||||
current local time as an aware :class:`~datetime.datetime` using the local
|
current local time as an aware :class:`~datetime.datetime` using the local
|
||||||
:class:`~datetime.timezone`. Given an aware :class:`~datetime.datetime`,
|
:class:`~datetime.timezone`. Given an aware :class:`~datetime.datetime`,
|
||||||
converts it into an aware :class:`~datetime.datetime` using the
|
converts it into an aware :class:`~datetime.datetime` using the
|
||||||
local :class:`~datetime.timezone`.
|
local :class:`~datetime.timezone`.
|
||||||
|
|
||||||
|
|
||||||
ftplib
|
ftplib
|
||||||
|
|
|
@ -1580,13 +1580,13 @@ The initialization of the default warnings filters has changed as follows:
|
||||||
* warnings filters enabled via the command line or the environment now have the
|
* warnings filters enabled via the command line or the environment now have the
|
||||||
following order of precedence:
|
following order of precedence:
|
||||||
|
|
||||||
* the ``BytesWarning`` filter for :option:`-b` (or ``-bb``)
|
* the ``BytesWarning`` filter for :option:`-b` (or ``-bb``)
|
||||||
* any filters specified with the :option:`-W` option
|
* any filters specified with the :option:`-W` option
|
||||||
* any filters specified with the :envvar:`PYTHONWARNINGS` environment
|
* any filters specified with the :envvar:`PYTHONWARNINGS` environment
|
||||||
variable
|
variable
|
||||||
* any other CPython specific filters (e.g. the ``default`` filter added
|
* any other CPython specific filters (e.g. the ``default`` filter added
|
||||||
for the new ``-X dev`` mode)
|
for the new ``-X dev`` mode)
|
||||||
* any implicit filters defined directly by the warnings machinery
|
* any implicit filters defined directly by the warnings machinery
|
||||||
|
|
||||||
* in :ref:`CPython debug builds <debug-build>`, all warnings are now displayed
|
* in :ref:`CPython debug builds <debug-build>`, all warnings are now displayed
|
||||||
by default (the implicit filter list is empty)
|
by default (the implicit filter list is empty)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue