Skip to content

Commit 6245cb3

Browse files
committed
Correct “an” → “a” with “Unicode”, “user”, “UTF”, etc
This affects documentation, code comments, and a debugging messages.
1 parent 7d82d03 commit 6245cb3

35 files changed

+52
-52
lines changed

Doc/c-api/exceptions.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ an error value).
285285
.. c:function:: int PyErr_WarnEx(PyObject *category, const char *message, Py_ssize_t stack_level)
286286
287287
Issue a warning message. The *category* argument is a warning category (see
288-
below) or *NULL*; the *message* argument is an UTF-8 encoded string. *stack_level* is a
288+
below) or *NULL*; the *message* argument is a UTF-8 encoded string. *stack_level* is a
289289
positive number giving a number of stack frames; the warning will be issued from
290290
the currently executing line of code in that stack frame. A *stack_level* of 1
291291
is the function calling :c:func:`PyErr_WarnEx`, 2 is the function above that,
@@ -609,7 +609,7 @@ The following functions are used to create and modify Unicode exceptions from C.
609609
.. c:function:: PyObject* PyUnicodeTranslateError_Create(const Py_UNICODE *object, Py_ssize_t length, Py_ssize_t start, Py_ssize_t end, const char *reason)
610610
611611
Create a :class:`UnicodeTranslateError` object with the attributes *object*,
612-
*length*, *start*, *end* and *reason*. *reason* is an UTF-8 encoded string.
612+
*length*, *start*, *end* and *reason*. *reason* is a UTF-8 encoded string.
613613
614614
.. c:function:: PyObject* PyUnicodeDecodeError_GetEncoding(PyObject *exc)
615615
PyObject* PyUnicodeEncodeError_GetEncoding(PyObject *exc)

Doc/c-api/import.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Importing Modules
7272
7373
.. c:function:: PyObject* PyImport_ImportModuleLevel(const char *name, PyObject *globals, PyObject *locals, PyObject *fromlist, int level)
7474
75-
Similar to :c:func:`PyImport_ImportModuleLevelObject`, but the name is an
75+
Similar to :c:func:`PyImport_ImportModuleLevelObject`, but the name is a
7676
UTF-8 encoded string instead of a Unicode object.
7777
7878
.. versionchanged:: 3.3

Doc/c-api/method.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Method Objects
4949
.. index:: object: method
5050
5151
Methods are bound function objects. Methods are always bound to an instance of
52-
an user-defined class. Unbound methods (methods bound to a class object) are
52+
a user-defined class. Unbound methods (methods bound to a class object) are
5353
no longer available.
5454
5555

Doc/c-api/module.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Module Objects
5050
5151
.. c:function:: PyObject* PyModule_New(const char *name)
5252
53-
Similar to :c:func:`PyImport_NewObject`, but the name is an UTF-8 encoded
53+
Similar to :c:func:`PyImport_NewObject`, but the name is a UTF-8 encoded
5454
string instead of a Unicode object.
5555
5656

Doc/c-api/unicode.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ APIs:
423423
424424
.. c:function:: PyObject *PyUnicode_FromString(const char *u)
425425
426-
Create a Unicode object from an UTF-8 encoded null-terminated char buffer
426+
Create a Unicode object from a UTF-8 encoded null-terminated char buffer
427427
*u*.
428428
429429
@@ -556,7 +556,7 @@ APIs:
556556
.. c:function:: PyObject* PyUnicode_FromEncodedObject(PyObject *obj, \
557557
const char *encoding, const char *errors)
558558
559-
Coerce an encoded object *obj* to an Unicode object and return a reference with
559+
Coerce an encoded object *obj* to a Unicode object and return a reference with
560560
incremented refcount.
561561
562562
:class:`bytes`, :class:`bytearray` and other
@@ -1224,7 +1224,7 @@ These are the UTF-16 codec APIs:
12241224
12251225
If *Py_UNICODE_WIDE* is defined, a single :c:type:`Py_UNICODE` value may get
12261226
represented as a surrogate pair. If it is not defined, each :c:type:`Py_UNICODE`
1227-
values is interpreted as an UCS-2 character.
1227+
values is interpreted as a UCS-2 character.
12281228
12291229
Return *NULL* if an exception was raised by the codec.
12301230

Doc/howto/urllib2.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ you can do so via the :func:`~urllib.request.urlretrieve` function::
6464
html = open(local_filename)
6565

6666
Many uses of urllib will be that simple (note that instead of an 'http:' URL we
67-
could have used an URL starting with 'ftp:', 'file:', etc.). However, it's the
67+
could have used a URL starting with 'ftp:', 'file:', etc.). However, it's the
6868
purpose of this tutorial to explain the more complicated cases, concentrating on
6969
HTTP.
7070

Doc/library/heapq.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ for a tournament. The numbers below are *k*, not ``a[k]``::
242242

243243
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
244244

245-
In the tree above, each cell *k* is topping ``2*k+1`` and ``2*k+2``. In an usual
245+
In the tree above, each cell *k* is topping ``2*k+1`` and ``2*k+2``. In a usual
246246
binary tournament we see in sports, each cell is the winner over the two cells
247247
it tops, and we can trace the winner down the tree to see all opponents s/he
248248
had. However, in many computer applications of such tournaments, we do not need

Doc/library/logging.handlers.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ supports sending logging messages to a Web server, using either ``GET`` or
866866

867867
.. method:: emit(record)
868868

869-
Sends the record to the Web server as an URL-encoded dictionary. The
869+
Sends the record to the Web server as a URL-encoded dictionary. The
870870
:meth:`mapLogRecord` method is used to convert the record to the
871871
dictionary to be sent.
872872

Doc/library/os.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1762,7 +1762,7 @@ features:
17621762
``os.path.join(os.path.dirname(path), result)``.
17631763

17641764
If the *path* is a string object, the result will also be a string object,
1765-
and the call may raise an UnicodeDecodeError. If the *path* is a bytes
1765+
and the call may raise a UnicodeDecodeError. If the *path* is a bytes
17661766
object, the result will be a bytes object.
17671767

17681768
This function can also support :ref:`paths relative to directory descriptors

Doc/library/re.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ those found in Perl.
1212

1313
Both patterns and strings to be searched can be Unicode strings as well as
1414
8-bit strings. However, Unicode strings and 8-bit strings cannot be mixed:
15-
that is, you cannot match an Unicode string with a byte pattern or
15+
that is, you cannot match a Unicode string with a byte pattern or
1616
vice-versa; similarly, when asking for a substitution, the replacement
1717
string must be of the same type as both the pattern and the search string.
1818

Doc/library/tkinter.ttk.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ the widget option ``displaycolumns``. The tree widget can also display column
701701
headings. Columns may be accessed by number or symbolic names listed in the
702702
widget option columns. See `Column Identifiers`_.
703703

704-
Each item is identified by an unique name. The widget will generate item IDs
704+
Each item is identified by a unique name. The widget will generate item IDs
705705
if they are not supplied by the caller. There is a distinguished root item,
706706
named ``{}``. The root item itself is not displayed; its children appear at the
707707
top level of the hierarchy.

Doc/library/webbrowser.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ browsers are not available on Unix, the controlling process will launch a new
3333
browser and wait.
3434

3535
The script :program:`webbrowser` can be used as a command-line interface for the
36-
module. It accepts an URL as the argument. It accepts the following optional
36+
module. It accepts a URL as the argument. It accepts the following optional
3737
parameters: ``-n`` opens the URL in a new browser window, if possible;
3838
``-t`` opens the URL in a new browser page ("tab"). The options are,
3939
naturally, mutually exclusive. Usage example::

Doc/library/xml.etree.elementtree.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ QName Objects
978978
to get proper namespace handling on output. *text_or_uri* is a string
979979
containing the QName value, in the form {uri}local, or, if the tag argument
980980
is given, the URI part of a QName. If *tag* is given, the first argument is
981-
interpreted as an URI, and this argument is interpreted as a local name.
981+
interpreted as a URI, and this argument is interpreted as a local name.
982982
:class:`QName` instances are opaque.
983983

984984

Doc/library/xml.sax.reader.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ The :class:`XMLReader` interface supports the following methods:
9898

9999
Process an input source, producing SAX events. The *source* object can be a
100100
system identifier (a string identifying the input source -- typically a file
101-
name or an URL), a file-like object, or an :class:`InputSource` object. When
101+
name or a URL), a file-like object, or an :class:`InputSource` object. When
102102
:meth:`parse` returns, the input is completely processed, and the parser object
103103
can be discarded or reset.
104104

Doc/library/xmlrpc.client.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ by providing an invalid URI::
420420

421421
import xmlrpc.client
422422

423-
# create a ServerProxy with an URI that doesn't respond to XMLRPC requests
423+
# create a ServerProxy with a URI that doesn't respond to XMLRPC requests
424424
proxy = xmlrpc.client.ServerProxy("http://google.com/")
425425

426426
try:

Include/bytesobject.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ PyAPI_FUNC(PyObject *) _PyBytes_Join(PyObject *sep, PyObject *x);
8282
#endif
8383

8484
/* Provides access to the internal data buffer and size of a string
85-
object or the default encoded version of an Unicode object. Passing
85+
object or the default encoded version of a Unicode object. Passing
8686
NULL as *len parameter will force the string buffer to be
8787
0-terminated (passing a string with embedded NULL characters will
8888
cause an exception). */

Include/unicodeobject.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ PyAPI_FUNC(int) PyUnicode_WriteChar(
823823
PyAPI_FUNC(Py_UNICODE) PyUnicode_GetMax(void);
824824
#endif
825825

826-
/* Resize an Unicode object. The length is the number of characters, except
826+
/* Resize a Unicode object. The length is the number of characters, except
827827
if the kind of the string is PyUnicode_WCHAR_KIND: in this case, the length
828828
is the number of Py_UNICODE characters.
829829
@@ -844,7 +844,7 @@ PyAPI_FUNC(int) PyUnicode_Resize(
844844
Py_ssize_t length /* New length */
845845
);
846846

847-
/* Coerce obj to an Unicode object and return a reference with
847+
/* Coerce obj to a Unicode object and return a reference with
848848
*incremented* refcount.
849849
850850
Coercion is done in the following way:
@@ -867,7 +867,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_FromEncodedObject(
867867
const char *errors /* error handling */
868868
);
869869

870-
/* Coerce obj to an Unicode object and return a reference with
870+
/* Coerce obj to a Unicode object and return a reference with
871871
*incremented* refcount.
872872
873873
Unicode objects are passed back as-is (subclasses are converted to
@@ -981,7 +981,7 @@ _PyUnicodeWriter_WriteLatin1String(_PyUnicodeWriter *writer,
981981
Py_ssize_t len /* length in bytes */
982982
);
983983

984-
/* Get the value of the writer as an Unicode string. Clear the
984+
/* Get the value of the writer as a Unicode string. Clear the
985985
buffer of the writer. Raise an exception and return NULL
986986
on error. */
987987
PyAPI_FUNC(PyObject *)

Lib/asyncio/windows_events.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def _unregister_wait_cb(self, fut):
197197
#
198198
# If the IocpProactor already received the event, it's safe to call
199199
# _unregister() because we kept a reference to the Overlapped object
200-
# which is used as an unique key.
200+
# which is used as a unique key.
201201
self._proactor._unregister(self._ov)
202202
self._proactor = None
203203

Lib/email/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def formataddr(pair, charset='utf-8'):
8787
'utf-8'.
8888
"""
8989
name, address = pair
90-
# The address MUST (per RFC) be ascii, so raise an UnicodeError if it isn't.
90+
# The address MUST (per RFC) be ascii, so raise a UnicodeError if it isn't.
9191
address.encode('ascii')
9292
if name:
9393
try:

Lib/heapq.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
5555
5656
In the tree above, each cell `k' is topping `2*k+1' and `2*k+2'. In
57-
an usual binary tournament we see in sports, each cell is the winner
57+
a usual binary tournament we see in sports, each cell is the winner
5858
over the two cells it tops, and we can trace the winner down the tree
5959
to see all opponents s/he had. However, in many computer applications
6060
of such tournaments, we do not need to trace the history of a winner.

Lib/nntplib.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class NNTPDataError(NNTPError):
165165

166166
# Helper function(s)
167167
def decode_header(header_str):
168-
"""Takes an unicode string representing a munged header value
168+
"""Takes a unicode string representing a munged header value
169169
and decodes it as a (possibly non-ASCII) readable value."""
170170
parts = []
171171
for v, enc in _email_decode_header(header_str):
@@ -420,7 +420,7 @@ def _putline(self, line):
420420

421421
def _putcmd(self, line):
422422
"""Internal: send one command to the server (through _putline()).
423-
The `line` must be an unicode string."""
423+
The `line` must be a unicode string."""
424424
if self.debugging: print('*cmd*', repr(line))
425425
line = line.encode(self.encoding, self.errors)
426426
self._putline(line)
@@ -445,7 +445,7 @@ def _getline(self, strip_crlf=True):
445445
def _getresp(self):
446446
"""Internal: get a response from the server.
447447
Raise various errors if the response indicates an error.
448-
Returns an unicode string."""
448+
Returns a unicode string."""
449449
resp = self._getline()
450450
if self.debugging: print('*resp*', repr(resp))
451451
resp = resp.decode(self.encoding, self.errors)
@@ -462,7 +462,7 @@ def _getlongresp(self, file=None):
462462
"""Internal: get a response plus following text from the server.
463463
Raise various errors if the response indicates an error.
464464
465-
Returns a (response, lines) tuple where `response` is an unicode
465+
Returns a (response, lines) tuple where `response` is a unicode
466466
string and `lines` is a list of bytes objects.
467467
If `file` is a file-like object, it must be open in binary mode.
468468
"""

Lib/ntpath.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def splitunc(p):
177177
Return a 2-tuple (unc, rest); either part may be empty.
178178
If unc is not empty, it has the form '//host/mount' (or similar
179179
using backslashes). unc+rest is always the input path.
180-
Paths containing drive letters never have an UNC part.
180+
Paths containing drive letters never have a UNC part.
181181
"""
182182
import warnings
183183
warnings.warn("ntpath.splitunc is deprecated, use ntpath.splitdrive instead",

Lib/test/test_codecs.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2355,7 +2355,7 @@ def test_decode_unicode(self):
23552355
self.assertRaises(TypeError, decoder, "xxx")
23562356

23572357
def test_unicode_escape(self):
2358-
# Escape-decoding an unicode string is supported ang gives the same
2358+
# Escape-decoding a unicode string is supported ang gives the same
23592359
# result as decoding the equivalent ASCII bytes string.
23602360
self.assertEqual(codecs.unicode_escape_decode(r"\u1234"), ("\u1234", 6))
23612361
self.assertEqual(codecs.unicode_escape_decode(br"\u1234"), ("\u1234", 6))

Lib/test/test_multibytecodec.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def test_init_segfault(self):
6767
_multibytecodec.MultibyteStreamWriter, None)
6868

6969
def test_decode_unicode(self):
70-
# Trying to decode an unicode string should raise a TypeError
70+
# Trying to decode a unicode string should raise a TypeError
7171
for enc in ALL_CJKENCODINGS:
7272
self.assertRaises(TypeError, codecs.getdecoder(enc), "")
7373

@@ -160,7 +160,7 @@ def test_iso2022(self):
160160
self.assertEqual(decoder.decode(b'B@$'), '\u4e16')
161161

162162
def test_decode_unicode(self):
163-
# Trying to decode an unicode string should raise a TypeError
163+
# Trying to decode a unicode string should raise a TypeError
164164
for enc in ALL_CJKENCODINGS:
165165
decoder = codecs.getincrementaldecoder(enc)()
166166
self.assertRaises(TypeError, decoder.decode, "")

Lib/test/test_nntplib.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ def handle_XOVER(self, message_spec):
609609
"\t\t6683\t16"
610610
"\t"
611611
"\n"
612-
# An UTF-8 overview line from fr.comp.lang.python
612+
# A UTF-8 overview line from fr.comp.lang.python
613613
"59\tRe: Message d'erreur incompréhensible (par moi)"
614614
"\tEric Brunel <eric.brunel@pragmadev.nospam.com>"
615615
"\tWed, 15 Sep 2010 18:09:15 +0200"

Lib/test/test_unicode.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1774,7 +1774,7 @@ def to_bytestring(self, seq):
17741774

17751775
def assertCorrectUTF8Decoding(self, seq, res, err):
17761776
"""
1777-
Check that an invalid UTF-8 sequence raises an UnicodeDecodeError when
1777+
Check that an invalid UTF-8 sequence raises a UnicodeDecodeError when
17781778
'strict' is used, returns res when 'replace' is used, and that doesn't
17791779
return anything when 'ignore' is used.
17801780
"""

Lib/test/test_zlib.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def test_speech128(self):
171171
self.assertEqual(zlib.decompress(ob), data)
172172

173173
def test_incomplete_stream(self):
174-
# An useful error message is given
174+
# A useful error message is given
175175
x = zlib.compress(HAMLET_SCENE)
176176
self.assertRaisesRegex(zlib.error,
177177
"Error -5 while decompressing data: incomplete or truncated stream",

Misc/HISTORY

+5-5
Original file line numberDiff line numberDiff line change
@@ -2237,7 +2237,7 @@ Library
22372237
attribute which allows setting custom per-pickler reduction functions.
22382238
Patch by sbt.
22392239

2240-
- Issue #14177: marshal.loads() now raises TypeError when given an unicode
2240+
- Issue #14177: marshal.loads() now raises TypeError when given a unicode
22412241
string. Patch by Guilherme Gonçalves.
22422242

22432243
- Issue #13550: Remove the debug machinery from the threading module: remove
@@ -8304,7 +8304,7 @@ Library
83048304
- Issue #1664: Make nntplib IPv6-capable. Patch by Derek Morr.
83058305

83068306
- Issue #5006: Better handling of unicode byte-order marks (BOM) in the io
8307-
library. This means, for example, that opening an UTF-16 text file in
8307+
library. This means, for example, that opening a UTF-16 text file in
83088308
append mode doesn't add a BOM at the end of the file if the file isn't
83098309
empty.
83108310

@@ -9328,7 +9328,7 @@ Library
93289328
- Issue #4756: zipfile.is_zipfile() now supports file-like objects. Patch by
93299329
Gabriel Genellina.
93309330

9331-
- Issue #4574: reading an UTF16-encoded text file crashes if \r on 64-char
9331+
- Issue #4574: reading a UTF16-encoded text file crashes if \r on 64-char
93329332
boundary.
93339333

93349334
- Issue #4223: inspect.getsource() will now correctly display source code
@@ -9929,7 +9929,7 @@ Extension Modules
99299929
exploitation of poor argument checking.
99309930

99319931
- bsddb code updated to version 4.7.3pre2. This code is the same than
9932-
Python 2.6 one, since the intention is to keep an unified 2.x/3.x codebase.
9932+
Python 2.6 one, since the intention is to keep a unified 2.x/3.x codebase.
99339933
The Python code is automatically translated using "2to3". Please, do not
99349934
update this code in Python 3.0 by hand. Update the 2.6 one and then
99359935
do "2to3".
@@ -18936,7 +18936,7 @@ Core language, builtins, and interpreter
1893618936

1893718937
- There is a new Unicode companion to the PyObject_Str() API
1893818938
called PyObject_Unicode(). It behaves in the same way as the
18939-
former, but assures that the returned value is an Unicode object
18939+
former, but assures that the returned value is a Unicode object
1894018940
(applying the usual coercion if necessary).
1894118941

1894218942
- The comparison operators support "rich comparison overloading" (PEP

0 commit comments

Comments
 (0)