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`.)
:func:`os.urandom` now uses ``getrandom()`` syscall on Linux 3.17 or newer,
and ``getentropy()`` on OpenBSD 5.6 and newer, removing the need to use
``/dev/urandom`` and avoiding failures due to potential file descriptor
The :func:`~os.urandom` function now uses ``getrandom()`` syscall on Linux 3.17
or newer, and ``getentropy()`` on OpenBSD 5.6 and newer, removing the need to
use ``/dev/urandom`` and avoiding failures due to potential file descriptor
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`.)
(Contributed by Victor Stinner in :issue:`22054`.)
:func:`~os.truncate` and :func:`~os.ftruncate` are now supported on
Windows. (Contributed by Steve Dower in :issue:`23668`.)
os.path
-------
The :func:`~os.truncate` and :func:`~os.ftruncate` functions are now supported
on Windows. (Contributed by Steve Dower in :issue:`23668`.)
There is a new :func:`~os.path.commonpath` function returning the longest
common sub-path of each passed pathname. Unlike the
...
...
@@ -1043,28 +1054,30 @@ path. (Contributed by Rafik Draoui and Serhiy Storchaka in :issue:`10395`.)
pathlib
-------
The new :meth:`~pathlib.Path.samefile` method can be used to check if the
passed :class:`~pathlib.Path` object, or a string, point to the same file as
the :class:`~pathlib.Path` on which :meth:`~pathlib.Path.samefile` is called.
The new :meth:`Path.samefile <pathlib.Path.samefile>` method can be used
to check if the passed :class:`~pathlib.Path` object or a :class:`str` path,
point to the same file.
(Contributed by Vajrasky Kok and Antoine Pitrou in :issue:`19775`.)
:meth:`~pathlib.Path.mkdir` how accepts a new optional ``exist_ok`` argument
to match ``mkdir -p`` and :func:`os.makrdirs` functionality.
(Contributed by Berker Peksag in :issue:`21539`.)
The :meth:`Path.mkdir <pathlib.Path.mkdir>` method how accepts a new optional
``exist_ok`` argument to match ``mkdir -p`` and :func:`os.makrdirs`
functionality. (Contributed by Berker Peksag in :issue:`21539`.)
There is a new :meth:`~pathlib.Path.expanduser` method to expand ``~``
and ``~user`` prefixes. (Contributed by Serhiy Storchaka and Claudiu
Popa in :issue:`19776`.)
There is a new :meth:`Path.expanduser <pathlib.Path.expanduser>` method to
expand ``~`` and ``~user`` prefixes. (Contributed by Serhiy Storchaka and
Claudiu Popa in :issue:`19776`.)
A new :meth:`~pathlib.Path.home` class method can be used to get an instance
of :class:`~pathlib.Path` object representing the user’s home directory.
A new :meth:`Path.home <pathlib.Path.home>` class method can be used to get
an instance of :class:`~pathlib.Path` object representing the user’s home
directory.
(Contributed by Victor Salgado and Mayank Tripathi in :issue:`19777`.)
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
:issue:`23611`.)
...
...
@@ -1072,7 +1085,7 @@ which already supported these cases. (Contributed by Serhiy Storchaka in
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.
(Contributed by Milan OberKirch in :issue:`21804`.)
...
...
@@ -1083,9 +1096,9 @@ re
The number of capturing groups in regular expression is no longer limited by
100. (Contributed by Serhiy Storchaka in :issue:`22437`.)
:func:`re.sub` and :func:`re.subn` now replace unmatched groups with empty
strings instead of rising an exception. (Contributed by Serhiy Storchaka
in :issue:`1519638`.)
The :func:`~re.sub` and :func:`~re.subn` functions now replace unmatched
groups with empty strings instead of rising an exception.
(Contributed by Serhiy Storchaka in :issue:`1519638`.)
readline
...
...
@@ -1099,20 +1112,21 @@ the specified number of trailing elements in history to a given file.
shutil
------
:func:`~shutil.move` now accepts a *copy_function* argument, allowing,
for example, :func:`~shutil.copy` to be used instead of the default
:func:`~shutil.copy2` there is a need to ignore file metadata when moving.
The :func:`~shutil.move` function now accepts a *copy_function* argument,
allowing, for example, the :func:`~shutil.copy` function to be used instead of
the default :func:`~shutil.copy2` if there is a need to ignore file metadata
when moving.
(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`.)
signal
------
On Windows, :func:`signal.set_wakeup_fd` now also supports socket handles.
(Contributed by Victor Stinner in :issue:`22018`.)
On Windows, the :func:`~signal.set_wakeup_fd` function now also supports
socket handles. (Contributed by Victor Stinner in :issue:`22018`.)
Various ``SIG*`` constants in :mod:`signal` module have been converted into
:mod:`Enums <enum>`. This allows meaningful names to be printed
...
...
@@ -1123,28 +1137,30 @@ during debugging, instead of integer "magic numbers".