summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Doc/c-api/import.rst2
-rw-r--r--Doc/faq/windows.rst10
-rw-r--r--Doc/library/doctest.rst2
-rw-r--r--Doc/library/pyexpat.rst2
-rw-r--r--Doc/library/smtpd.rst13
-rw-r--r--Doc/library/timeit.rst20
-rw-r--r--Doc/tools/sphinxext/susp-ignored.csv3
-rw-r--r--Doc/whatsnew/3.3.rst9
-rw-r--r--Lib/test/test_xml_etree.py12
-rw-r--r--Lib/xml/etree/ElementTree.py2
-rw-r--r--Misc/NEWS6
-rw-r--r--Modules/_io/_iomodule.c2
-rw-r--r--Modules/_io/iobase.c2
-rw-r--r--Modules/_io/textio.c2
-rw-r--r--Modules/posixmodule.c9
-rw-r--r--Objects/typeobject.c6
16 files changed, 64 insertions, 38 deletions
diff --git a/Doc/c-api/import.rst b/Doc/c-api/import.rst
index c3c8f42..270152e 100644
--- a/Doc/c-api/import.rst
+++ b/Doc/c-api/import.rst
@@ -76,7 +76,7 @@ Importing Modules
UTF-8 encoded string instead of a Unicode object.
.. versionchanged:: 3.3
- Negative values for **level** are no longer accepted.
+ Negative values for *level* are no longer accepted.
.. c:function:: PyObject* PyImport_Import(PyObject *name)
diff --git a/Doc/faq/windows.rst b/Doc/faq/windows.rst
index 68a1b5c..84e3ff4 100644
--- a/Doc/faq/windows.rst
+++ b/Doc/faq/windows.rst
@@ -464,13 +464,13 @@ to console subprocesses which are designed to handle those signals. See
Why does os.path.isdir() fail on NT shared directories?
-------------------------------------------------------
-The solution appears to be always append the "\\" on the end of shared
-drives.
+In order to work correctly, :func:`os.path.isdir` requires a ``"\\"`` at the
+end of the shared drive::
>>> import os
- >>> os.path.isdir( '\\\\rorschach\\public')
+ >>> os.path.isdir('\\\\rorschach\\public')
0
- >>> os.path.isdir( '\\\\rorschach\\public\\')
+ >>> os.path.isdir('\\\\rorschach\\public\\')
1
It helps to think of share points as being like drive letters. Example::
@@ -480,7 +480,7 @@ It helps to think of share points as being like drive letters. Example::
k:\media is a directory
k:\media\ is not a directory
-The same rules apply if you substitute "k:" with "\\conky\foo"::
+The same rules apply if you substitute ``"k:"`` with ``"\\conky\foo"``::
\\conky\foo is not a directory
\\conky\foo\ is a directory
diff --git a/Doc/library/doctest.rst b/Doc/library/doctest.rst
index cad03bd..ed53f06 100644
--- a/Doc/library/doctest.rst
+++ b/Doc/library/doctest.rst
@@ -338,7 +338,7 @@ The fine print:
Backslashes in a raw docstring: m\n
Otherwise, the backslash will be interpreted as part of the string. For example,
- the "\\" above would be interpreted as a newline character. Alternatively, you
+ the ``\n`` above would be interpreted as a newline character. Alternatively, you
can double each backslash in the doctest version (and not use a raw string)::
>>> def f(x):
diff --git a/Doc/library/pyexpat.rst b/Doc/library/pyexpat.rst
index a648cfa..861546c 100644
--- a/Doc/library/pyexpat.rst
+++ b/Doc/library/pyexpat.rst
@@ -402,7 +402,7 @@ otherwise stated.
.. method:: xmlparser.CommentHandler(data)
Called for comments. *data* is the text of the comment, excluding the leading
- '``<!-``\ ``-``' and trailing '``-``\ ``->``'.
+ ``'<!-``\ ``-'`` and trailing ``'-``\ ``->'``.
.. method:: xmlparser.StartCdataSectionHandler()
diff --git a/Doc/library/smtpd.rst b/Doc/library/smtpd.rst
index 6dd477a..2ca71ff 100644
--- a/Doc/library/smtpd.rst
+++ b/Doc/library/smtpd.rst
@@ -111,12 +111,13 @@ SMTPChannel Objects
.. attribute:: addr
Holds the address of the client, the second value returned by
- socket.accept()
+ :func:`socket.accept <socket.socket.accept>`
.. attribute:: received_lines
Holds a list of the line strings (decoded using UTF-8) received from
- the client. The lines have their "\\r\\n" line ending translated to "\\n".
+ the client. The lines have their ``"\r\n"`` line ending translated to
+ ``"\n"``.
.. attribute:: smtp_state
@@ -141,12 +142,12 @@ SMTPChannel Objects
.. attribute:: received_data
Holds a string containing all of the data sent by the client during the
- DATA state, up to but not including the terminating "\r\n.\r\n".
+ DATA state, up to but not including the terminating ``"\r\n.\r\n"``.
.. attribute:: fqdn
Holds the fully-qualified domain name of the server as returned by
- ``socket.getfqdn()``.
+ :func:`socket.getfqdn`.
.. attribute:: peer
@@ -170,14 +171,14 @@ SMTPChannel Objects
MAIL Accepts the "MAIL FROM:" syntax and stores the supplied address as
:attr:`mailfrom`. In extended command mode, accepts the
:rfc:`1870` SIZE attribute and responds appropriately based on the
- value of ``data_size_limit``.
+ value of *data_size_limit*.
RCPT Accepts the "RCPT TO:" syntax and stores the supplied addresses in
the :attr:`rcpttos` list.
RSET Resets the :attr:`mailfrom`, :attr:`rcpttos`, and
:attr:`received_data`, but not the greeting.
DATA Sets the internal state to :attr:`DATA` and stores remaining lines
from the client in :attr:`received_data` until the terminator
- "\r\n.\r\n" is received.
+ ``"\r\n.\r\n"`` is received.
HELP Returns minimal information on command syntax
VRFY Returns code 252 (the server doesn't know if the address is valid)
EXPN Reports that the command is not implemented.
diff --git a/Doc/library/timeit.rst b/Doc/library/timeit.rst
index c41e59d..6989b1c 100644
--- a/Doc/library/timeit.rst
+++ b/Doc/library/timeit.rst
@@ -31,13 +31,13 @@ The module defines the following public class:
may also contain multiple statements separated by ``;`` or newlines, as long as
they don't contain multi-line string literals.
- To measure the execution time of the first statement, use the :meth:`timeit`
- method. The :meth:`repeat` method is a convenience to call :meth:`timeit`
+ To measure the execution time of the first statement, use the :meth:`Timer.timeit`
+ method. The :meth:`repeat` method is a convenience to call :meth:`.timeit`
multiple times and return a list of results.
The *stmt* and *setup* parameters can also take objects that are callable
without arguments. This will embed calls to them in a timer function that
- will then be executed by :meth:`timeit`. Note that the timing overhead is a
+ will then be executed by :meth:`.timeit`. Note that the timing overhead is a
little larger in this case because of the extra function calls.
@@ -60,12 +60,12 @@ The module defines the following public class:
.. method:: Timer.repeat(repeat=3, number=1000000)
- Call :meth:`timeit` a few times.
+ Call :meth:`.timeit` a few times.
- This is a convenience function that calls the :meth:`timeit` repeatedly,
+ This is a convenience function that calls the :meth:`.timeit` repeatedly,
returning a list of results. The first argument specifies how many times to
- call :meth:`timeit`. The second argument specifies the *number* argument for
- :func:`timeit`.
+ call :meth:`.timeit`. The second argument specifies the *number* argument for
+ :meth:`.timeit`.
.. note::
@@ -89,7 +89,7 @@ The module defines the following public class:
.. note::
- By default, :meth:`timeit` temporarily turns off :term:`garbage collection`
+ By default, :meth:`.timeit` temporarily turns off :term:`garbage collection`
during the timing. The advantage of this approach is that it makes
independent timings more comparable. This disadvantage is that GC may be
an important component of the performance of the function being measured.
@@ -117,7 +117,7 @@ The module also defines three convenience functions:
.. function:: timeit(stmt='pass', setup='pass', timer=<default timer>, number=1000000)
Create a :class:`Timer` instance with the given statement, setup code and timer
- function and run its :meth:`timeit` method with *number* executions.
+ function and run its :meth:`.timeit` method with *number* executions.
Command Line Interface
@@ -243,7 +243,7 @@ attributes. ::
3.15 usec/pass
To give the :mod:`timeit` module access to functions you define, you can pass a
-``setup`` parameter which contains an import statement::
+*setup* parameter which contains an import statement::
def test():
"""Stupid test function"""
diff --git a/Doc/tools/sphinxext/susp-ignored.csv b/Doc/tools/sphinxext/susp-ignored.csv
index 7317ca2..138e000 100644
--- a/Doc/tools/sphinxext/susp-ignored.csv
+++ b/Doc/tools/sphinxext/susp-ignored.csv
@@ -124,9 +124,8 @@ library/functions,,:step,a[start:stop:step]
library/functions,,:stop,"a[start:stop, i]"
library/functions,,:stop,a[start:stop:step]
library/hotshot,,:lineno,"ncalls tottime percall cumtime percall filename:lineno(function)"
-library/http.client,52,:port,host:port
+library/http.client,,:port,host:port
library/http.cookies,,`,!#$%&'*+-.^_`|~:
-library/httplib,,:port,host:port
library/imaplib,,:MM,"""DD-Mmm-YYYY HH:MM:SS"
library/imaplib,,:SS,"""DD-Mmm-YYYY HH:MM:SS"
library/inspect,,:int,">>> def foo(a, *, b:int, **kwargs):"
diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst
index caa838f..7d77472 100644
--- a/Doc/whatsnew/3.3.rst
+++ b/Doc/whatsnew/3.3.rst
@@ -69,6 +69,7 @@ New library modules:
* :mod:`faulthandler` (helps debugging low-level crashes)
* :mod:`ipaddress` (high-level objects representing IP addresses and masks)
* :mod:`lzma` (compress data using the XZ / LZMA algorithm)
+* :mod:`unittest.mock` (replace parts of your system under test with mock objects)
* :mod:`venv` (Python :ref:`virtual environments <pep-405>`, as in the
popular ``virtualenv`` package)
@@ -923,7 +924,7 @@ New Modules
faulthandler
------------
-This new debug module contains functions to dump Python tracebacks explicitly,
+This new debug module :mod:`faulthandler` contains functions to dump Python tracebacks explicitly,
on a fault (a crash like a segmentation fault), after a timeout, or on a user
signal. Call :func:`faulthandler.enable` to install fault handlers for the
:const:`SIGSEGV`, :const:`SIGFPE`, :const:`SIGABRT`, :const:`SIGBUS`, and
@@ -1927,7 +1928,7 @@ Porting Python code
updated to use the full name of the module instead of just the tail of the
name.
-* The **index** argument to :func:`__import__` now defaults to 0 instead of -1
+* The *index* argument to :func:`__import__` now defaults to 0 instead of -1
and no longer support negative values. It was an oversight when :pep:`328` was
implemented that the default value remained -1. If you need to continue to
perform a relative import followed by an absolute import, then perform the
@@ -1995,9 +1996,9 @@ Porting C code
* :c:func:`PyImport_GetMagicNumber` now returns -1 upon failure.
-* As a negative value for the **level** argument to :func:`__import__` is no
+* As a negative value for the *level* argument to :func:`__import__` is no
longer valid, the same now holds for :c:func:`PyImport_ImportModuleLevel`.
- This also means that the value of **level** used by
+ This also means that the value of *level* used by
:c:func:`PyImport_ImportModuleEx` is now 0 instead of -1.
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py
index da1ad09..97d64fc 100644
--- a/Lib/test/test_xml_etree.py
+++ b/Lib/test/test_xml_etree.py
@@ -1809,6 +1809,18 @@ class ElementTreeTest(unittest.TestCase):
mye = MyElement('joe')
self.assertEqual(mye.newmethod(), 'joe')
+ def test_html_empty_elems_serialization(self):
+ # issue 15970
+ # from http://www.w3.org/TR/html401/index/elements.html
+ for element in ['AREA', 'BASE', 'BASEFONT', 'BR', 'COL', 'FRAME', 'HR',
+ 'IMG', 'INPUT', 'ISINDEX', 'LINK', 'META', 'PARAM']:
+ for elem in [element, element.lower()]:
+ expected = '<%s>' % elem
+ serialized = serialize(ET.XML('<%s />' % elem), method='html')
+ self.assertEqual(serialized, expected)
+ serialized = serialize(ET.XML('<%s></%s>' % (elem,elem)),
+ method='html')
+ self.assertEqual(serialized, expected)
class ElementIterTest(unittest.TestCase):
def _ilist(self, elem, tag=None):
diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py
index ea4fa7a..b9d8df6 100644
--- a/Lib/xml/etree/ElementTree.py
+++ b/Lib/xml/etree/ElementTree.py
@@ -995,7 +995,7 @@ def _serialize_xml(write, elem, qnames, namespaces):
write(_escape_cdata(elem.tail))
HTML_EMPTY = ("area", "base", "basefont", "br", "col", "frame", "hr",
- "img", "input", "isindex", "link", "meta" "param")
+ "img", "input", "isindex", "link", "meta", "param")
try:
HTML_EMPTY = set(HTML_EMPTY)
diff --git a/Misc/NEWS b/Misc/NEWS
index 63434ba..da84c3a 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@ What's New in Python 3.3.1
Core and Builtins
-----------------
+- Issue #15965: Explicitly cast AT_FDCWD as (int). Required on Solaris 10
+ (which defines AT_FDCWD as 0xffd19553), harmless on other platforms.
+
- Issue #15926: Fix crash after multiple reinitializations of the interpreter.
- Issue #15895: Fix FILE pointer leak in one error branch of
@@ -29,6 +32,9 @@ Core and Builtins
Library
-------
+- Issue #15970: xml.etree.ElementTree now serializes correctly the empty HTML
+ elements 'meta' and 'param'.
+
- Issue #15842: the SocketIO.{readable,writable,seekable} methods now
raise ValueError when the file-like object is closed. Patch by Alessandro
Moura.
diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c
index 0622c58..d3a87e7 100644
--- a/Modules/_io/_iomodule.c
+++ b/Modules/_io/_iomodule.c
@@ -185,7 +185,7 @@ PyDoc_STRVAR(open_doc,
"\n"
"* On output, if newline is None, any '\\n' characters written are\n"
" translated to the system default line separator, os.linesep. If\n"
-" newline is '' or '\n', no translation takes place. If newline is any\n"
+" newline is '' or '\\n', no translation takes place. If newline is any\n"
" of the other legal values, any '\\n' characters written are translated\n"
" to the given string.\n"
"\n"
diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c
index dd052ae..babb019 100644
--- a/Modules/_io/iobase.c
+++ b/Modules/_io/iobase.c
@@ -442,7 +442,7 @@ PyDoc_STRVAR(iobase_readline_doc,
"\n"
"If limit is specified, at most limit bytes will be read.\n"
"\n"
- "The line terminator is always b'\n' for binary files; for text\n"
+ "The line terminator is always b'\\n' for binary files; for text\n"
"files, the newlines argument to open can be used to select the line\n"
"terminator(s) recognized.\n");
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
index fb9b674..96434a8 100644
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -648,7 +648,7 @@ PyDoc_STRVAR(textiowrapper_doc,
"\n"
"* On output, if newline is None, any '\\n' characters written are\n"
" translated to the system default line separator, os.linesep. If\n"
- " newline is '' or '\n', no translation takes place. If newline is any\n"
+ " newline is '' or '\\n', no translation takes place. If newline is any\n"
" of the other legal values, any '\\n' characters written are translated\n"
" to the given string.\n"
"\n"
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 54f6cd2..e0efebf 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -414,7 +414,14 @@ win32_warn_bytes_api()
#ifdef AT_FDCWD
-#define DEFAULT_DIR_FD AT_FDCWD
+/*
+ * Why the (int) cast? Solaris 10 defines AT_FDCWD as 0xffd19553 (-3041965);
+ * without the int cast, the value gets interpreted as uint (4291925331),
+ * which doesn't play nicely with all the initializer lines in this file that
+ * look like this:
+ * int dir_fd = DEFAULT_DIR_FD;
+ */
+#define DEFAULT_DIR_FD (int)AT_FDCWD
#else
#define DEFAULT_DIR_FD (-100)
#endif
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 88cca93..5d625a2 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -5992,7 +5992,7 @@ update_one_slot(PyTypeObject *type, slotdef *p)
descr = _PyType_Lookup(type, p->name_strobj);
if (descr == NULL) {
if (ptr == (void**)&type->tp_iternext) {
- specific = _PyObject_NextNotImplemented;
+ specific = (void *)_PyObject_NextNotImplemented;
}
continue;
}
@@ -6039,7 +6039,7 @@ update_one_slot(PyTypeObject *type, slotdef *p)
/* We specifically allow __hash__ to be set to None
to prevent inheritance of the default
implementation from object.__hash__ */
- specific = PyObject_HashNotImplemented;
+ specific = (void *)PyObject_HashNotImplemented;
}
else {
use_generic = 1;
@@ -6254,7 +6254,7 @@ add_operators(PyTypeObject *type)
continue;
if (PyDict_GetItem(dict, p->name_strobj))
continue;
- if (*ptr == PyObject_HashNotImplemented) {
+ if (*ptr == (void *)PyObject_HashNotImplemented) {
/* Classes may prevent the inheritance of the tp_hash
slot by storing PyObject_HashNotImplemented in it. Make it
visible as a None value for the __hash__ attribute. */