Kaydet (Commit) c652ce6d authored tarafından R David Murray's avatar R David Murray

More whatsnew adds, especially the os module.

I went through all the versionchanged/versionadded tags in the os doc page for
this changeset.
üst b7a0bfe9
...@@ -1504,12 +1504,20 @@ os ...@@ -1504,12 +1504,20 @@ os
:func:`~os.link`, :func:`~os.lstat`, :func:`~os.mkdir`, :func:`~os.mkfifo`, :func:`~os.link`, :func:`~os.lstat`, :func:`~os.mkdir`, :func:`~os.mkfifo`,
:func:`~os.mknod`, :func:`~os.open`, :func:`~os.readlink`, :func:`~os.remove`, :func:`~os.mknod`, :func:`~os.open`, :func:`~os.readlink`, :func:`~os.remove`,
:func:`~os.rename`, :func:`~os.replace`, :func:`~os.rmdir`, :func:`~os.stat`, :func:`~os.rename`, :func:`~os.replace`, :func:`~os.rmdir`, :func:`~os.stat`,
:func:`~os.symlink`, :func:`~os.unlink`, :func:`~os.utime`. :func:`~os.symlink`, :func:`~os.unlink`, :func:`~os.utime`. Platform
support for using these parameters can be checked via the sets
:data:`os.supports_dir_fd` and :data:`os.supports_follows_symlinks`.
- The following functions now support a file descriptor for their path argument: - The following functions now support a file descriptor for their path argument:
:func:`~os.chdir`, :func:`~os.chmod`, :func:`~os.chown`, :func:`~os.chdir`, :func:`~os.chmod`, :func:`~os.chown`,
:func:`~os.execve`, :func:`~os.listdir`, :func:`~os.pathconf`, :func:`~os.path.exists`, :func:`~os.execve`, :func:`~os.listdir`, :func:`~os.pathconf`, :func:`~os.path.exists`,
:func:`~os.stat`, :func:`~os.statvfs`, :func:`~os.utime`. :func:`~os.stat`, :func:`~os.statvfs`, :func:`~os.utime`. Platform support
for this can be checked via the :data:`os.supports_fd` set.
* :func:`~os.access` accepts an ``effective_ids`` keyword argument to turn on
using the effective uid/gid rather than the real uid/gid in the access check.
Platform support for this can be checked via the
:data:`~os.supports_effective_ids` set.
* The :mod:`os` module has two new functions: :func:`~os.getpriority` and * The :mod:`os` module has two new functions: :func:`~os.getpriority` and
:func:`~os.setpriority`. They can be used to get or set process :func:`~os.setpriority`. They can be used to get or set process
...@@ -1558,7 +1566,7 @@ os ...@@ -1558,7 +1566,7 @@ os
for a file. for a file.
* :func:`~os.sync`: Force write of everything to disk. * :func:`~os.sync`: Force write of everything to disk.
* Add some extra posix functions to the os module: * Additional new posix functions:
* :func:`~os.lockf`: Apply, test or remove a POSIX lock on an open file descriptor. * :func:`~os.lockf`: Apply, test or remove a POSIX lock on an open file descriptor.
* :func:`~os.pread`: Read from a file descriptor at an offset, the file * :func:`~os.pread`: Read from a file descriptor at an offset, the file
...@@ -1577,6 +1585,12 @@ os ...@@ -1577,6 +1585,12 @@ os
* :func:`~os.times` and :func:`~os.uname`: Return type changed from a tuple to * :func:`~os.times` and :func:`~os.uname`: Return type changed from a tuple to
a tuple-like object with named attributes. a tuple-like object with named attributes.
* Some platforms now support additional constants for the :func:`~os.lseek`
function, such as ``os.SEEK_HOLE`` and ``os.SEEK_DATA``.
* :func:`os.symlink` now accepts (and ignores) the ``target_is_directory``
keyword argument on non-Windows platforms, to ease cross-platform support.
pdb pdb
--- ---
...@@ -1703,6 +1717,14 @@ signal ...@@ -1703,6 +1717,14 @@ signal
instead of a RuntimeError: OSError has an errno attribute. instead of a RuntimeError: OSError has an errno attribute.
smtp
----
:class:`~smtplib.SMTP` now supports the context manager protocol, allowing an
``SMTP`` instance to be used in a ``with`` statement. (Contributed
by Giampaolo Rodolà in :issue:`11289`.)
smtpd smtpd
----- -----
...@@ -1810,6 +1832,18 @@ the form '-rwxrwxrwx'. ...@@ -1810,6 +1832,18 @@ the form '-rwxrwxrwx'.
(Contributed by Giampaolo Rodolà in :issue:`14807`) (Contributed by Giampaolo Rodolà in :issue:`14807`)
subprocess
----------
Command strings can now be bytes objects on posix platforms. (Contributed by
Victor Stiner in :issue:`8513`.)
A new constant :data:`~subprocess.DEVNULL` allows suppressing output in a
platform-independent fashion. (Contributed by Ross Lagerwall in
:issue:`5870`.)
sys sys
--- ---
...@@ -1872,10 +1906,11 @@ unittest ...@@ -1872,10 +1906,11 @@ unittest
:meth:`.assertRaises`, :meth:`.assertRaisesRegex`, :meth:`.assertWarns`, and :meth:`.assertRaises`, :meth:`.assertRaisesRegex`, :meth:`.assertWarns`, and
:meth:`.assertWarnsRegex` now accept a keyword argument *msg* when used as :meth:`.assertWarnsRegex` now accept a keyword argument *msg* when used as
context managers. context managers. (Contributed by Ezio Melotti and Winston Ewert in
:issue:`10775`)
(Contributed by Ezio Melotti and Winston Ewert in :issue:`10775`)
:meth:`unittest.TestCase.run` now returns the :class:`~unittest.TestResult`
object.
urllib urllib
------ ------
...@@ -1993,7 +2028,7 @@ Deprecated Python modules, functions and methods ...@@ -1993,7 +2028,7 @@ Deprecated Python modules, functions and methods
* :meth:`ftplib.FTP.nlst` and :meth:`ftplib.FTP.dir`: use * :meth:`ftplib.FTP.nlst` and :meth:`ftplib.FTP.dir`: use
:meth:`ftplib.FTP.mlsd` :meth:`ftplib.FTP.mlsd`
* :func:`platform.popen`: use the :mod:`subprocess` module. Check especially * :func:`platform.popen`: use the :mod:`subprocess` module. Check especially
the :ref:`subprocess-replacements` section. the :ref:`subprocess-replacements` section (:issue:`11377`).
* :issue:`13374`: The Windows bytes API has been deprecated in the :mod:`os` * :issue:`13374`: The Windows bytes API has been deprecated in the :mod:`os`
module. Use Unicode filenames, instead of bytes filenames, to not depend on module. Use Unicode filenames, instead of bytes filenames, to not depend on
the ANSI code page anymore and to support any filename. the ANSI code page anymore and to support any filename.
......
...@@ -3690,7 +3690,7 @@ Library ...@@ -3690,7 +3690,7 @@ Library
not installed. Instead, the zipfile.ZIP_STORED compression is used to create not installed. Instead, the zipfile.ZIP_STORED compression is used to create
the ZipFile. Patch by Natalia B. Bidart. the ZipFile. Patch by Natalia B. Bidart.
- Issue #11289: `smtp.SMTP` class becomes a context manager so it can be used - Issue #11289: `smtp.SMTP` class is now a context manager so it can be used
in a `with` statement. Contributed by Giampaolo Rodola. in a `with` statement. Contributed by Giampaolo Rodola.
- Issue #11554: Fixed support for Japanese codecs; previously the body output - Issue #11554: Fixed support for Japanese codecs; previously the body output
...@@ -3702,7 +3702,7 @@ Library ...@@ -3702,7 +3702,7 @@ Library
- Issue #11407: `TestCase.run` returns the result object used or created. - Issue #11407: `TestCase.run` returns the result object used or created.
Contributed by Janathan Hartley. Contributed by Janathan Hartley.
- Issue #11500: Fixed a bug in the os x proxy bypass code for fully qualified - Issue #11500: Fixed a bug in the OS X proxy bypass code for fully qualified
IP addresses in the proxy exception list. IP addresses in the proxy exception list.
- Issue #11491: dbm.error is no longer raised when dbm.open is called with - Issue #11491: dbm.error is no longer raised when dbm.open is called with
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment