This commit is contained in:
Christian Heimes 2012-09-20 12:43:24 +02:00
commit 1c47222a25
16 changed files with 64 additions and 38 deletions

View File

@ -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)

View File

@ -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

View File

@ -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):

View File

@ -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()

View File

@ -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.

View File

@ -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"""

View File

@ -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):"

1 c-api/arg :ref PyArg_ParseTuple(args, "O|O:ref", &object, &callback)
124 library/functions :stop a[start:stop, i]
125 library/functions :stop a[start:stop:step]
126 library/hotshot :lineno ncalls tottime percall cumtime percall filename:lineno(function)
127 library/http.client 52 :port host:port
128 library/http.cookies ` !#$%&'*+-.^_`|~:
library/httplib :port host:port
129 library/imaplib :MM "DD-Mmm-YYYY HH:MM:SS
130 library/imaplib :SS "DD-Mmm-YYYY HH:MM:SS
131 library/inspect :int >>> def foo(a, *, b:int, **kwargs):

View File

@ -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.

View File

@ -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):

View File

@ -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)

View File

@ -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.

View File

@ -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"

View File

@ -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");

View File

@ -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"

View File

@ -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

View File

@ -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. */