[Python-checkins] cpython (merge 3.5 -> default): Merge 3.5
yury.selivanov
python-checkins at python.org
Sun Sep 13 07:42:13 CEST 2015
https://hg.python.org/cpython/rev/c8171af00966
changeset: 97965:c8171af00966
parent: 97963:9faede0c33a8
parent: 97964:ef2423d18c1c
user: Yury Selivanov <yselivanov at sprymix.com>
date: Sun Sep 13 01:10:29 2015 -0400
summary:
Merge 3.5
files:
Doc/whatsnew/3.5.rst | 29 +++++++++++++++++++++++++++--
1 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/Doc/whatsnew/3.5.rst b/Doc/whatsnew/3.5.rst
--- a/Doc/whatsnew/3.5.rst
+++ b/Doc/whatsnew/3.5.rst
@@ -1339,7 +1339,16 @@
:meth:`~logging.Logger.exception`, :meth:`~logging.Logger.critical`,
:meth:`~logging.Logger.debug`, etc.), now accept exception instances
as an ``exc_info`` argument, in addition to boolean values and exception
-tuples. (Contributed by Yury Selivanov in :issue:`20537`.)
+tuples::
+
+ >>> import logging
+ >>> try:
+ ... 1/0
+ ... except ZeroDivisionError as ex:
+ ... logging.error('exception', exc_info=ex)
+ ERROR:root:exception
+
+(Contributed by Yury Selivanov in :issue:`20537`.)
The :class:`handlers.HTTPHandler <logging.handlers.HTTPHandler>` class now
accepts an optional :class:`ssl.SSLContext` instance to configure SSL
@@ -1442,7 +1451,14 @@
The new :meth:`Path.samefile <pathlib.Path.samefile>` method can be used
to check whether the path points to the same file as other path, which can be
-either an another :class:`~pathlib.Path` object, or a string.
+either an another :class:`~pathlib.Path` object, or a string::
+
+ >>> import pathlib
+ >>> p1 = pathlib.Path('/etc/hosts')
+ >>> p2 = pathlib.Path('/etc/../etc/hosts')
+ >>> p1.samefile(p2)
+ True
+
(Contributed by Vajrasky Kok and Antoine Pitrou in :issue:`19775`.)
The :meth:`Path.mkdir <pathlib.Path.mkdir>` method how accepts a new optional
@@ -1463,6 +1479,15 @@
:meth:`Path.write_bytes <pathlib.Path.write_bytes>`,
:meth:`Path.read_bytes <pathlib.Path.read_bytes>` methods to simplify
read/write operations on files.
+
+The following code snippet will create or rewrite existing file
+``~/spam42``::
+
+ >>> import pathlib
+ >>> p = pathlib.Path('~/spam42')
+ >>> p.expanduser().write_text('ham')
+ 3
+
(Contributed by Christopher Welborn in :issue:`20218`.)
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list