``BY_HANDLE_FILE_INFORMATION`` structure returned by
attribute is now available. It corresponds to ``dwFileAttributes`` member of
the ``BY_HANDLE_FILE_INFORMATION`` structure returned by
``GetFileInformationByHandle()``. (Contributed by Ben Hoyt in :issue:`21719`.)
``GetFileInformationByHandle()``. (Contributed by Ben Hoyt in :issue:`21719`.)
:func:`os.urandom` now uses ``getrandom()`` syscall on Linux 3.17 or newer,
The :func:`~os.urandom` function now uses ``getrandom()`` syscall on Linux 3.17
and ``getentropy()`` on OpenBSD 5.6 and newer, removing the need to use
or newer, and ``getentropy()`` on OpenBSD 5.6 and newer, removing the need to
``/dev/urandom`` and avoiding failures due to potential file descriptor
use ``/dev/urandom`` and avoiding failures due to potential file descriptor
exhaustion. (Contributed by Victor Stinner in :issue:`22181`.)
exhaustion. (Contributed by Victor Stinner in :issue:`22181`.)
New :func:`os.get_blocking` and :func:`os.set_blocking` functions allow to
New :func:`~os.get_blocking` and :func:`~os.set_blocking` functions allow to
get and set the file descriptor blocking mode (:data:`~os.O_NONBLOCK`.)
get and set the file descriptor blocking mode (:data:`~os.O_NONBLOCK`.)
(Contributed by Victor Stinner in :issue:`22054`.)
(Contributed by Victor Stinner in :issue:`22054`.)
:func:`~os.truncate` and :func:`~os.ftruncate` are now supported on
The :func:`~os.truncate` and :func:`~os.ftruncate` functions are now supported
Windows. (Contributed by Steve Dower in :issue:`23668`.)
on Windows. (Contributed by Steve Dower in :issue:`23668`.)
os.path
-------
There is a new :func:`~os.path.commonpath` function returning the longest
There is a new :func:`~os.path.commonpath` function returning the longest
common sub-path of each passed pathname. Unlike the
common sub-path of each passed pathname. Unlike the
...
@@ -1043,28 +1054,30 @@ path. (Contributed by Rafik Draoui and Serhiy Storchaka in :issue:`10395`.)
...
@@ -1043,28 +1054,30 @@ path. (Contributed by Rafik Draoui and Serhiy Storchaka in :issue:`10395`.)
pathlib
pathlib
-------
-------
The new :meth:`~pathlib.Path.samefile` method can be used to check if the
The new :meth:`Path.samefile <pathlib.Path.samefile>` method can be used
passed :class:`~pathlib.Path` object, or a string, point to the same file as
to check if the passed :class:`~pathlib.Path` object or a :class:`str` path,
the :class:`~pathlib.Path` on which :meth:`~pathlib.Path.samefile` is called.
point to the same file.
(Contributed by Vajrasky Kok and Antoine Pitrou in :issue:`19775`.)
(Contributed by Vajrasky Kok and Antoine Pitrou in :issue:`19775`.)
:meth:`~pathlib.Path.mkdir` how accepts a new optional ``exist_ok`` argument
The :meth:`Path.mkdir <pathlib.Path.mkdir>` method how accepts a new optional
to match ``mkdir -p`` and :func:`os.makrdirs` functionality.
``exist_ok`` argument to match ``mkdir -p`` and :func:`os.makrdirs`
(Contributed by Berker Peksag in :issue:`21539`.)
functionality. (Contributed by Berker Peksag in :issue:`21539`.)
There is a new :meth:`~pathlib.Path.expanduser` method to expand ``~``
There is a new :meth:`Path.expanduser <pathlib.Path.expanduser>` method to
and ``~user`` prefixes. (Contributed by Serhiy Storchaka and Claudiu
expand ``~`` and ``~user`` prefixes. (Contributed by Serhiy Storchaka and
Popa in :issue:`19776`.)
Claudiu Popa in :issue:`19776`.)
A new :meth:`~pathlib.Path.home` class method can be used to get an instance
A new :meth:`Path.home <pathlib.Path.home>` class method can be used to get
of :class:`~pathlib.Path` object representing the user’s home directory.
an instance of :class:`~pathlib.Path` object representing the user’s home
directory.
(Contributed by Victor Salgado and Mayank Tripathi in :issue:`19777`.)
(Contributed by Victor Salgado and Mayank Tripathi in :issue:`19777`.)
pickle
pickle
------
------
Nested objects, such as unbound methods or nested classes, can now be pickled using :ref:`pickle protocols <pickle-protocols>` older than protocol version 4,
Nested objects, such as unbound methods or nested classes, can now be pickled
using :ref:`pickle protocols <pickle-protocols>` older than protocol version 4,
which already supported these cases. (Contributed by Serhiy Storchaka in
which already supported these cases. (Contributed by Serhiy Storchaka in
:issue:`23611`.)
:issue:`23611`.)
...
@@ -1072,7 +1085,7 @@ which already supported these cases. (Contributed by Serhiy Storchaka in
...
@@ -1072,7 +1085,7 @@ which already supported these cases. (Contributed by Serhiy Storchaka in
poplib
poplib
------
------
A new command :meth:`~poplib.POP3.utf8` enables :rfc:`6856`
A new command :meth:`POP3.utf8 <poplib.POP3.utf8>` enables :rfc:`6856`
(internationalized email) support, if the POP server supports it.
(internationalized email) support, if the POP server supports it.
(Contributed by Milan OberKirch in :issue:`21804`.)
(Contributed by Milan OberKirch in :issue:`21804`.)
...
@@ -1083,9 +1096,9 @@ re
...
@@ -1083,9 +1096,9 @@ re
The number of capturing groups in regular expression is no longer limited by
The number of capturing groups in regular expression is no longer limited by
100. (Contributed by Serhiy Storchaka in :issue:`22437`.)
100. (Contributed by Serhiy Storchaka in :issue:`22437`.)
:func:`re.sub` and :func:`re.subn` now replace unmatched groups with empty
The :func:`~re.sub` and :func:`~re.subn` functions now replace unmatched
strings instead of rising an exception. (Contributed by Serhiy Storchaka
groups with empty strings instead of rising an exception.
in :issue:`1519638`.)
(Contributed by Serhiy Storchaka in :issue:`1519638`.)
readline
readline
...
@@ -1099,20 +1112,21 @@ the specified number of trailing elements in history to a given file.
...
@@ -1099,20 +1112,21 @@ the specified number of trailing elements in history to a given file.
shutil
shutil
------
------
:func:`~shutil.move` now accepts a *copy_function* argument, allowing,
The :func:`~shutil.move` function now accepts a *copy_function* argument,
for example, :func:`~shutil.copy` to be used instead of the default
allowing, for example, the :func:`~shutil.copy` function to be used instead of
:func:`~shutil.copy2` there is a need to ignore file metadata when moving.
the default :func:`~shutil.copy2` if there is a need to ignore file metadata
when moving.
(Contributed by Claudiu Popa in :issue:`19840`.)
(Contributed by Claudiu Popa in :issue:`19840`.)
:func:`~shutil.make_archive` now supports *xztar* format.
The :func:`~shutil.make_archive` function now supports *xztar* format.
(Contributed by Serhiy Storchaka in :issue:`5411`.)
(Contributed by Serhiy Storchaka in :issue:`5411`.)
signal
signal
------
------
On Windows, :func:`signal.set_wakeup_fd` now also supports socket handles.
On Windows, the :func:`~signal.set_wakeup_fd` function now also supports
(Contributed by Victor Stinner in :issue:`22018`.)
socket handles. (Contributed by Victor Stinner in :issue:`22018`.)
Various ``SIG*`` constants in :mod:`signal` module have been converted into
Various ``SIG*`` constants in :mod:`signal` module have been converted into
:mod:`Enums <enum>`. This allows meaningful names to be printed
:mod:`Enums <enum>`. This allows meaningful names to be printed
...
@@ -1123,28 +1137,30 @@ during debugging, instead of integer "magic numbers".
...
@@ -1123,28 +1137,30 @@ during debugging, instead of integer "magic numbers".