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

whatsnew: ssl getpeercert/do_handshake raise OSError, weakref __callback__.

Also add a missing word to gc entry, and delete a now-obsolete doc note
in the weakref __callback__ docs.  (Opened an issue for rewriting
the section that compares finalizers and __del__ method.)
üst 98358275
...@@ -123,15 +123,6 @@ Extension types can easily be made to support weak references; see ...@@ -123,15 +123,6 @@ Extension types can easily be made to support weak references; see
weakref. If there is no callback or if the referent of the weakref is weakref. If there is no callback or if the referent of the weakref is
no longer alive then this attribute will have value ``None``. no longer alive then this attribute will have value ``None``.
.. note::
Like :meth:`__del__` methods, weak reference callbacks can be
called during interpreter shutdown when module globals have been
overwritten with :const:`None`. This can make writing robust
weak reference callbacks a challenge. Callbacks registered
using :class:`finalize` do not have to worry about this issue
because they will not be run after module teardown has begun.
.. versionchanged:: 3.4 .. versionchanged:: 3.4
Added the :attr:`__callback__` attribute. Added the :attr:`__callback__` attribute.
...@@ -247,7 +238,7 @@ These method have the same issues as the and :meth:`keyrefs` method of ...@@ -247,7 +238,7 @@ These method have the same issues as the and :meth:`keyrefs` method of
.. class:: finalize(obj, func, *args, **kwargs) .. class:: finalize(obj, func, *args, **kwargs)
Return a callable finalizer object which will be called when *obj* Return a callable finalizer object which will be called when *obj*
is garbage collected. Unlike an ordinary weak reference, a finalizer is is garbage collected. Unlike an ordinary weak reference, a finalizer
will always survive until the reference object is collected, greatly will always survive until the reference object is collected, greatly
simplifying lifecycle management. simplifying lifecycle management.
......
...@@ -657,9 +657,9 @@ available for other implementations to use. (Contributed by Brian Thorne in ...@@ -657,9 +657,9 @@ available for other implementations to use. (Contributed by Brian Thorne in
gc gc
-- --
New :func:`~gc.get_stats` returns a list of three per-generation dictionaries New function :func:`~gc.get_stats` returns a list of three per-generation
containing the collections statistics since interpreter startup. (Contributed dictionaries containing the collections statistics since interpreter startup.
by Antoine Pitrou in :issue:`16351`.) (Contributed by Antoine Pitrou in :issue:`16351`.)
hashlib hashlib
...@@ -1103,6 +1103,10 @@ to be invoked when an object is garbage collected, without needing to ...@@ -1103,6 +1103,10 @@ to be invoked when an object is garbage collected, without needing to
carefully manage the lifecycle of the weak reference itself. (Contributed by carefully manage the lifecycle of the weak reference itself. (Contributed by
Richard Oudkerk in :issue:`15528`) Richard Oudkerk in :issue:`15528`)
The callback, if any, associated with a :class:`~weakref.ref` is now
exposed via the :attr:`~weakref.ref.__callback__` attribute. (Contributed
by Mark Dickinson in :issue:`17643`.)
xml.etree xml.etree
--------- ---------
...@@ -1482,6 +1486,12 @@ Changes in the Python API ...@@ -1482,6 +1486,12 @@ Changes in the Python API
compliance with the language spec; Jython and PyPy already were. compliance with the language spec; Jython and PyPy already were.
(:issue:`17434`). (:issue:`17434`).
* :meth:`ssl.SSLSocket.getpeercert` and :meth:`ssl.SSLSocket.do_handshake`
now raise an :exc:`OSError` with ``ENOTCONN`` when the ``SSLSocket`` is not
connected, instead of the previous behavior of raising an
:exc:`AttributError`. In addition, :meth:`~ssl.SSLSocket.getpeercert`
will raise a :exc:`ValueError` if the handshake has not yet been done.
Changes in the C API Changes in the C API
-------------------- --------------------
......
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