diff options
author | Martin Panter <vadmium+py@gmail.com> | 2016-04-15 02:27:11 +0000 |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2016-04-15 02:27:11 +0000 |
commit | 2bde55ad3c25edcb6265893a8c8eee203a6a179b (patch) | |
tree | eda96042f11fa5437a35fbb167cb4ff90d1f8a03 /Doc | |
parent | e1a3b9029ccb28cd9adf04b7b89ca6167dc09fdb (diff) | |
parent | 4a529361db83f3753b4385b97dc2d12c333607f0 (diff) | |
download | cpython-2bde55ad3c25edcb6265893a8c8eee203a6a179b.tar.gz |
Issue #15984: Merge PyUnicode doc from 3.5
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/c-api/exceptions.rst | 4 | ||||
-rw-r--r-- | Doc/c-api/import.rst | 2 | ||||
-rw-r--r-- | Doc/c-api/method.rst | 2 | ||||
-rw-r--r-- | Doc/c-api/module.rst | 2 | ||||
-rw-r--r-- | Doc/c-api/unicode.rst | 16 | ||||
-rw-r--r-- | Doc/howto/urllib2.rst | 2 | ||||
-rw-r--r-- | Doc/library/heapq.rst | 2 | ||||
-rw-r--r-- | Doc/library/logging.handlers.rst | 2 | ||||
-rw-r--r-- | Doc/library/os.rst | 2 | ||||
-rw-r--r-- | Doc/library/re.rst | 2 | ||||
-rw-r--r-- | Doc/library/tkinter.ttk.rst | 2 | ||||
-rw-r--r-- | Doc/library/webbrowser.rst | 2 | ||||
-rw-r--r-- | Doc/library/xml.etree.elementtree.rst | 2 | ||||
-rw-r--r-- | Doc/library/xml.sax.reader.rst | 2 | ||||
-rw-r--r-- | Doc/library/xmlrpc.client.rst | 2 |
15 files changed, 24 insertions, 22 deletions
diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index 57f36acc85..226b61972f 100644 --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -285,7 +285,7 @@ an error value). .. c:function:: int PyErr_WarnEx(PyObject *category, const char *message, Py_ssize_t stack_level) Issue a warning message. The *category* argument is a warning category (see - below) or *NULL*; the *message* argument is an UTF-8 encoded string. *stack_level* is a + below) or *NULL*; the *message* argument is a UTF-8 encoded string. *stack_level* is a positive number giving a number of stack frames; the warning will be issued from the currently executing line of code in that stack frame. A *stack_level* of 1 is the function calling :c:func:`PyErr_WarnEx`, 2 is the function above that, @@ -617,7 +617,7 @@ The following functions are used to create and modify Unicode exceptions from C. .. c:function:: PyObject* PyUnicodeTranslateError_Create(const Py_UNICODE *object, Py_ssize_t length, Py_ssize_t start, Py_ssize_t end, const char *reason) Create a :class:`UnicodeTranslateError` object with the attributes *object*, - *length*, *start*, *end* and *reason*. *reason* is an UTF-8 encoded string. + *length*, *start*, *end* and *reason*. *reason* is a UTF-8 encoded string. .. c:function:: PyObject* PyUnicodeDecodeError_GetEncoding(PyObject *exc) PyObject* PyUnicodeEncodeError_GetEncoding(PyObject *exc) diff --git a/Doc/c-api/import.rst b/Doc/c-api/import.rst index 15a9e25501..86c1d7d6e3 100644 --- a/Doc/c-api/import.rst +++ b/Doc/c-api/import.rst @@ -72,7 +72,7 @@ Importing Modules .. c:function:: PyObject* PyImport_ImportModuleLevel(const char *name, PyObject *globals, PyObject *locals, PyObject *fromlist, int level) - Similar to :c:func:`PyImport_ImportModuleLevelObject`, but the name is an + Similar to :c:func:`PyImport_ImportModuleLevelObject`, but the name is a UTF-8 encoded string instead of a Unicode object. .. versionchanged:: 3.3 diff --git a/Doc/c-api/method.rst b/Doc/c-api/method.rst index acc81e4814..7a2a84fe11 100644 --- a/Doc/c-api/method.rst +++ b/Doc/c-api/method.rst @@ -49,7 +49,7 @@ Method Objects .. index:: object: method Methods are bound function objects. Methods are always bound to an instance of -an user-defined class. Unbound methods (methods bound to a class object) are +a user-defined class. Unbound methods (methods bound to a class object) are no longer available. diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst index ef778ccaed..97a63546a9 100644 --- a/Doc/c-api/module.rst +++ b/Doc/c-api/module.rst @@ -50,7 +50,7 @@ Module Objects .. c:function:: PyObject* PyModule_New(const char *name) - Similar to :c:func:`PyImport_NewObject`, but the name is an UTF-8 encoded + Similar to :c:func:`PyImport_NewObject`, but the name is a UTF-8 encoded string instead of a Unicode object. diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst index 2eeadb52c9..1ed81403b4 100644 --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -423,7 +423,7 @@ APIs: .. c:function:: PyObject *PyUnicode_FromString(const char *u) - Create a Unicode object from an UTF-8 encoded null-terminated char buffer + Create a Unicode object from a UTF-8 encoded null-terminated char buffer *u*. @@ -556,14 +556,13 @@ APIs: .. c:function:: PyObject* PyUnicode_FromEncodedObject(PyObject *obj, \ const char *encoding, const char *errors) - Coerce an encoded object *obj* to an Unicode object and return a reference with - incremented refcount. + Decode an encoded object *obj* to a Unicode object. :class:`bytes`, :class:`bytearray` and other :term:`bytes-like objects <bytes-like object>` are decoded according to the given *encoding* and using the error handling defined by *errors*. Both can be *NULL* to have the interface use the default - values (see the next section for details). + values (see :ref:`builtincodecs` for details). All other objects, including Unicode objects, cause a :exc:`TypeError` to be set. @@ -745,8 +744,11 @@ Extension modules can continue using them, as they will not be removed in Python .. c:function:: PyObject* PyUnicode_FromObject(PyObject *obj) - Shortcut for ``PyUnicode_FromEncodedObject(obj, NULL, "strict")`` which is used - throughout the interpreter whenever coercion to Unicode is needed. + Copy an instance of a Unicode subtype to a new true Unicode object if + necessary. If *obj* is already a true Unicode object (not a subtype), + return the reference with incremented refcount. + + Objects other than Unicode or its subtypes will cause a :exc:`TypeError`. Locale Encoding @@ -1224,7 +1226,7 @@ These are the UTF-16 codec APIs: If *Py_UNICODE_WIDE* is defined, a single :c:type:`Py_UNICODE` value may get represented as a surrogate pair. If it is not defined, each :c:type:`Py_UNICODE` - values is interpreted as an UCS-2 character. + values is interpreted as a UCS-2 character. Return *NULL* if an exception was raised by the codec. diff --git a/Doc/howto/urllib2.rst b/Doc/howto/urllib2.rst index 7d5044b319..0d04c9f4e6 100644 --- a/Doc/howto/urllib2.rst +++ b/Doc/howto/urllib2.rst @@ -64,7 +64,7 @@ you can do so via the :func:`~urllib.request.urlretrieve` function:: html = open(local_filename) Many uses of urllib will be that simple (note that instead of an 'http:' URL we -could have used an URL starting with 'ftp:', 'file:', etc.). However, it's the +could have used a URL starting with 'ftp:', 'file:', etc.). However, it's the purpose of this tutorial to explain the more complicated cases, concentrating on HTTP. diff --git a/Doc/library/heapq.rst b/Doc/library/heapq.rst index e29a31b3b3..45720bfaac 100644 --- a/Doc/library/heapq.rst +++ b/Doc/library/heapq.rst @@ -242,7 +242,7 @@ for a tournament. The numbers below are *k*, not ``a[k]``:: 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 -In the tree above, each cell *k* is topping ``2*k+1`` and ``2*k+2``. In an usual +In the tree above, each cell *k* is topping ``2*k+1`` and ``2*k+2``. In a usual binary tournament we see in sports, each cell is the winner over the two cells it tops, and we can trace the winner down the tree to see all opponents s/he had. However, in many computer applications of such tournaments, we do not need diff --git a/Doc/library/logging.handlers.rst b/Doc/library/logging.handlers.rst index 90efc45d35..f89d6c346f 100644 --- a/Doc/library/logging.handlers.rst +++ b/Doc/library/logging.handlers.rst @@ -874,7 +874,7 @@ supports sending logging messages to a Web server, using either ``GET`` or .. method:: emit(record) - Sends the record to the Web server as an URL-encoded dictionary. The + Sends the record to the Web server as a URL-encoded dictionary. The :meth:`mapLogRecord` method is used to convert the record to the dictionary to be sent. diff --git a/Doc/library/os.rst b/Doc/library/os.rst index 289276a9a5..051db9960a 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1762,7 +1762,7 @@ features: ``os.path.join(os.path.dirname(path), result)``. If the *path* is a string object, the result will also be a string object, - and the call may raise an UnicodeDecodeError. If the *path* is a bytes + and the call may raise a UnicodeDecodeError. If the *path* is a bytes object, the result will be a bytes object. This function can also support :ref:`paths relative to directory descriptors diff --git a/Doc/library/re.rst b/Doc/library/re.rst index 1df768c328..fdd5083d74 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -12,7 +12,7 @@ those found in Perl. Both patterns and strings to be searched can be Unicode strings as well as 8-bit strings. However, Unicode strings and 8-bit strings cannot be mixed: -that is, you cannot match an Unicode string with a byte pattern or +that is, you cannot match a Unicode string with a byte pattern or vice-versa; similarly, when asking for a substitution, the replacement string must be of the same type as both the pattern and the search string. diff --git a/Doc/library/tkinter.ttk.rst b/Doc/library/tkinter.ttk.rst index 4efdfac8a9..7aebddcaf5 100644 --- a/Doc/library/tkinter.ttk.rst +++ b/Doc/library/tkinter.ttk.rst @@ -701,7 +701,7 @@ the widget option ``displaycolumns``. The tree widget can also display column headings. Columns may be accessed by number or symbolic names listed in the widget option columns. See `Column Identifiers`_. -Each item is identified by an unique name. The widget will generate item IDs +Each item is identified by a unique name. The widget will generate item IDs if they are not supplied by the caller. There is a distinguished root item, named ``{}``. The root item itself is not displayed; its children appear at the top level of the hierarchy. diff --git a/Doc/library/webbrowser.rst b/Doc/library/webbrowser.rst index aa5e4ad15d..17c6dc365a 100644 --- a/Doc/library/webbrowser.rst +++ b/Doc/library/webbrowser.rst @@ -33,7 +33,7 @@ browsers are not available on Unix, the controlling process will launch a new browser and wait. The script :program:`webbrowser` can be used as a command-line interface for the -module. It accepts an URL as the argument. It accepts the following optional +module. It accepts a URL as the argument. It accepts the following optional parameters: ``-n`` opens the URL in a new browser window, if possible; ``-t`` opens the URL in a new browser page ("tab"). The options are, naturally, mutually exclusive. Usage example:: diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst index fe7ad9841a..01fccb3559 100644 --- a/Doc/library/xml.etree.elementtree.rst +++ b/Doc/library/xml.etree.elementtree.rst @@ -978,7 +978,7 @@ QName Objects to get proper namespace handling on output. *text_or_uri* is a string containing the QName value, in the form {uri}local, or, if the tag argument is given, the URI part of a QName. If *tag* is given, the first argument is - interpreted as an URI, and this argument is interpreted as a local name. + interpreted as a URI, and this argument is interpreted as a local name. :class:`QName` instances are opaque. diff --git a/Doc/library/xml.sax.reader.rst b/Doc/library/xml.sax.reader.rst index 31ca260f7c..b4acd4cdbb 100644 --- a/Doc/library/xml.sax.reader.rst +++ b/Doc/library/xml.sax.reader.rst @@ -98,7 +98,7 @@ The :class:`XMLReader` interface supports the following methods: Process an input source, producing SAX events. The *source* object can be a system identifier (a string identifying the input source -- typically a file - name or an URL), a file-like object, or an :class:`InputSource` object. When + name or a URL), a file-like object, or an :class:`InputSource` object. When :meth:`parse` returns, the input is completely processed, and the parser object can be discarded or reset. diff --git a/Doc/library/xmlrpc.client.rst b/Doc/library/xmlrpc.client.rst index a12e6e18e0..980516873c 100644 --- a/Doc/library/xmlrpc.client.rst +++ b/Doc/library/xmlrpc.client.rst @@ -420,7 +420,7 @@ by providing an invalid URI:: import xmlrpc.client - # create a ServerProxy with an URI that doesn't respond to XMLRPC requests + # create a ServerProxy with a URI that doesn't respond to XMLRPC requests proxy = xmlrpc.client.ServerProxy("http://google.com/") try: |