summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Doc/c-api/init.rst5
-rw-r--r--Doc/c-api/list.rst6
-rw-r--r--Doc/library/difflib.rst1
-rw-r--r--Doc/library/logging.rst32
-rw-r--r--Doc/library/pickle.rst2
-rw-r--r--Doc/library/unittest.rst2
-rw-r--r--Doc/library/zipfile.rst4
-rw-r--r--Doc/reference/expressions.rst7
-rw-r--r--Lib/_weakrefset.py6
-rwxr-xr-xLib/pydoc.py2
-rw-r--r--Lib/test/test_weakset.py3
-rw-r--r--Misc/NEWS7
12 files changed, 42 insertions, 35 deletions
diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst
index 5add7fe..fd6a9a2 100644
--- a/Doc/c-api/init.rst
+++ b/Doc/c-api/init.rst
@@ -319,8 +319,9 @@ Process-wide parameters
.. cfunction:: void Py_SetPythonHome(char *home)
Set the default "home" directory, that is, the location of the standard
- Python libraries. The libraries are searched in
- :file:`{home}/lib/python{version}` and :file:`{home}/lib/python{version}`.
+ Python libraries. See :envvar:`PYTHONHOME` for the meaning of the
+ argument string.
+
The argument should point to a zero-terminated character string in static
storage whose contents will not change for the duration of the program's
execution. No code in the Python interpreter will change the contents of
diff --git a/Doc/c-api/list.rst b/Doc/c-api/list.rst
index 242b4e6..d24aa72 100644
--- a/Doc/c-api/list.rst
+++ b/Doc/c-api/list.rst
@@ -42,7 +42,7 @@ List Objects
.. note::
- If *length* is greater than zero, the returned list object's items are
+ If *len* is greater than zero, the returned list object's items are
set to ``NULL``. Thus you cannot use abstract API functions such as
:cfunc:`PySequence_SetItem` or expose the object to Python code before
setting all items to a real object with :cfunc:`PyList_SetItem`.
@@ -75,9 +75,9 @@ List Objects
.. cfunction:: PyObject* PyList_GetItem(PyObject *list, Py_ssize_t index)
- Return the object at position *pos* in the list pointed to by *p*. The
+ Return the object at position *index* in the list pointed to by *list*. The
position must be positive, indexing from the end of the list is not
- supported. If *pos* is out of bounds, return *NULL* and set an
+ supported. If *index* is out of bounds, return *NULL* and set an
:exc:`IndexError` exception.
.. versionchanged:: 2.5
diff --git a/Doc/library/difflib.rst b/Doc/library/difflib.rst
index d51e230..225b486 100644
--- a/Doc/library/difflib.rst
+++ b/Doc/library/difflib.rst
@@ -368,7 +368,6 @@ The :class:`SequenceMatcher` class has this constructor:
:class:`SequenceMatcher` objects have the following methods:
-
.. method:: set_seqs(a, b)
Set the two sequences to be compared.
diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst
index aa3a6aa..9898d08 100644
--- a/Doc/library/logging.rst
+++ b/Doc/library/logging.rst
@@ -539,10 +539,7 @@ what handlers are most appropriate for their application: if you add handlers
unit tests and deliver logs which suit their requirements.
.. versionadded:: 2.7
-
-The :class:`NullHandler` class was not present in previous versions, but is now
-included, so that it need not be defined in library code.
-
+ The :class:`NullHandler` class.
Logging Levels
@@ -672,8 +669,7 @@ provided:
more information.
.. versionadded:: 2.7
-
-The :class:`NullHandler` class was not present in previous versions.
+ The :class:`NullHandler` class.
The :class:`NullHandler`, :class:`StreamHandler` and :class:`FileHandler`
classes are defined in the core logging package. The other handlers are
@@ -932,6 +928,7 @@ functions.
which need to use custom logger behavior.
+
.. seealso::
:pep:`282` - A Logging System
@@ -1944,6 +1941,7 @@ sends logging output to a disk file. It inherits the output functionality from
Outputs the record to the file.
+
.. _null-handler:
NullHandler
@@ -1955,12 +1953,10 @@ The :class:`NullHandler` class, located in the core :mod:`logging` package,
does not do any formatting or output. It is essentially a "no-op" handler
for use by library developers.
-
.. class:: NullHandler()
Returns a new instance of the :class:`NullHandler` class.
-
.. method:: emit(record)
This method does nothing.
@@ -2794,6 +2790,7 @@ wire).
.. versionchanged:: 2.5
*func* was added.
+
.. _logger-adapter:
LoggerAdapter Objects
@@ -2803,22 +2800,21 @@ LoggerAdapter Objects
:class:`LoggerAdapter` instances are used to conveniently pass contextual
information into logging calls. For a usage example , see the section on
-`adding contextual information to your logging output`__.
+:ref:`adding contextual information to your logging output <context-info>`.
-__ context-info_
.. class:: LoggerAdapter(logger, extra)
- Returns an instance of :class:`LoggerAdapter` initialized with an
- underlying :class:`Logger` instance and a dict-like object.
+ Returns an instance of :class:`LoggerAdapter` initialized with an
+ underlying :class:`Logger` instance and a dict-like object.
- .. method:: process(msg, kwargs)
+ .. method:: process(msg, kwargs)
- Modifies the message and/or keyword arguments passed to a logging call in
- order to insert contextual information. This implementation takes the object
- passed as *extra* to the constructor and adds it to *kwargs* using key
- 'extra'. The return value is a (*msg*, *kwargs*) tuple which has the
- (possibly modified) versions of the arguments passed in.
+ Modifies the message and/or keyword arguments passed to a logging call in
+ order to insert contextual information. This implementation takes the object
+ passed as *extra* to the constructor and adds it to *kwargs* using key
+ 'extra'. The return value is a (*msg*, *kwargs*) tuple which has the
+ (possibly modified) versions of the arguments passed in.
In addition to the above, :class:`LoggerAdapter` supports all the logging
methods of :class:`Logger`, i.e. :meth:`debug`, :meth:`info`, :meth:`warning`,
diff --git a/Doc/library/pickle.rst b/Doc/library/pickle.rst
index 963468d..22165f9 100644
--- a/Doc/library/pickle.rst
+++ b/Doc/library/pickle.rst
@@ -53,7 +53,7 @@ general :mod:`pickle` should always be the preferred way to serialize Python
objects. :mod:`marshal` exists primarily to support Python's :file:`.pyc`
files.
-The :mod:`pickle` module differs from :mod:`marshal` several significant ways:
+The :mod:`pickle` module differs from :mod:`marshal` in several significant ways:
* The :mod:`pickle` module keeps track of the objects it has already serialized,
so that later references to the same object won't be serialized again.
diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst
index 657cab2..333b399 100644
--- a/Doc/library/unittest.rst
+++ b/Doc/library/unittest.rst
@@ -1752,10 +1752,8 @@ Loading and running tests
load_tests Protocol
###################
-
.. versionadded:: 2.7
-
Modules or packages can customize how tests are loaded from them during normal
test runs or test discovery by implementing a function called ``load_tests``.
diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst
index 48f5900..51240ba 100644
--- a/Doc/library/zipfile.rst
+++ b/Doc/library/zipfile.rst
@@ -176,8 +176,8 @@ ZipFile Objects
.. note::
The file-like object is read-only and provides the following methods:
- :meth:`read`, :meth:`readline`, :meth:`readlines`, :meth:`__iter__`,
- :meth:`next`.
+ :meth:`!read`, :meth:`!readline`, :meth:`!readlines`, :meth:`!__iter__`,
+ :meth:`!next`.
.. note::
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst
index da67dd3..067a3d6 100644
--- a/Doc/reference/expressions.rst
+++ b/Doc/reference/expressions.rst
@@ -1392,8 +1392,8 @@ groups from right to left).
true numerically due to roundoff. For example, and assuming a platform on which
a Python float is an IEEE 754 double-precision number, in order that ``-1e-100 %
1e100`` have the same sign as ``1e100``, the computed result is ``-1e-100 +
- 1e100``, which is numerically exactly equal to ``1e100``. Function :func:`fmod`
- in the :mod:`math` module returns a result whose sign matches the sign of the
+ 1e100``, which is numerically exactly equal to ``1e100``. The function
+ :func:`math.fmod` returns a result whose sign matches the sign of the
first argument instead, and so returns ``-1e-100`` in this case. Which approach
is more appropriate depends on the application.
@@ -1423,7 +1423,8 @@ groups from right to left).
the :keyword:`is` operator, like those involving comparisons between instance
methods, or constants. Check their documentation for more info.
-.. [#] The ``%`` is also used for string formatting; the same precedence applies.
+.. [#] The ``%`` operator is also used for string formatting; the same
+ precedence applies.
.. [#] The power operator ``**`` binds less tightly than an arithmetic or
bitwise unary operator on its right, that is, ``2**-1`` is ``0.5``.
diff --git a/Lib/_weakrefset.py b/Lib/_weakrefset.py
index 90e07d4..ffa5e31 100644
--- a/Lib/_weakrefset.py
+++ b/Lib/_weakrefset.py
@@ -66,7 +66,11 @@ class WeakSet(object):
return sum(x() is not None for x in self.data)
def __contains__(self, item):
- return ref(item) in self.data
+ try:
+ wr = ref(item)
+ except TypeError:
+ return False
+ return wr in self.data
def __reduce__(self):
return (self.__class__, (list(self),),
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index 90fa1b3..ff9a5f4 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -1113,7 +1113,7 @@ class TextDoc(Doc):
result = result + self.section('CREDITS', str(object.__credits__))
return result
- def docclass(self, object, name=None, mod=None):
+ def docclass(self, object, name=None, mod=None, *ignored):
"""Produce text documentation for a given class object."""
realname = object.__name__
name = name or realname
diff --git a/Lib/test/test_weakset.py b/Lib/test/test_weakset.py
index b4774ce..89c2822 100644
--- a/Lib/test/test_weakset.py
+++ b/Lib/test/test_weakset.py
@@ -62,7 +62,8 @@ class TestWeakSet(unittest.TestCase):
def test_contains(self):
for c in self.letters:
self.assertEqual(c in self.s, c in self.d)
- self.assertRaises(TypeError, self.s.__contains__, [[]])
+ # 1 is not weakref'able, but that TypeError is caught by __contains__
+ self.assertNotIn(1, self.s)
self.assertIn(self.obj, self.fs)
del self.obj
self.assertNotIn(SomeClass('F'), self.fs)
diff --git a/Misc/NEWS b/Misc/NEWS
index f1536c2..7e796ef 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -41,6 +41,13 @@ Library
4GB, even on 32-bit builds. Initial patch by Ross Lagerwall, adapted for
32-bit Windows.
+- Issue #10360: In WeakSet, do not raise TypeErrors when testing for
+ membership of non-weakrefable objects.
+
+- Issue #10549: Fix pydoc traceback when text-documenting certain classes.
+
+- Issue #940286: pydoc.Helper.help() ignores input/output init parameters.
+
- Issue #11171: Fix detection of config/Makefile when --prefix !=
--exec-prefix, which caused Python to not start.