Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 19e6238

Browse files
committed
Fix stupid typo in Lib/encodings/utf_32.py which led to failing tests
on big endian machines. Update documentation: UTF-32 codecs will be in 2.6.
1 parent 8d991ed commit 19e6238

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

Doc/c-api/concrete.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,7 +1434,7 @@ These are the UTF-32 codec APIs:
14341434

14351435
Return *NULL* if an exception was raised by the codec.
14361436

1437-
.. versionadded:: 3.0
1437+
.. versionadded:: 2.6
14381438

14391439

14401440
.. cfunction:: PyObject* PyUnicode_DecodeUTF32Stateful(const char *s, Py_ssize_t size, const char *errors, int *byteorder, Py_ssize_t *consumed)
@@ -1445,7 +1445,7 @@ These are the UTF-32 codec APIs:
14451445
by four) as an error. Those bytes will not be decoded and the number of bytes
14461446
that have been decoded will be stored in *consumed*.
14471447

1448-
.. versionadded:: 3.0
1448+
.. versionadded:: 2.6
14491449

14501450

14511451
.. cfunction:: PyObject* PyUnicode_EncodeUTF32(const Py_UNICODE *s, Py_ssize_t size, const char *errors, int byteorder)
@@ -1466,13 +1466,18 @@ These are the UTF-32 codec APIs:
14661466

14671467
Return *NULL* if an exception was raised by the codec.
14681468

1469+
.. versionadded:: 2.6
1470+
14691471

14701472
.. cfunction:: PyObject* PyUnicode_AsUTF32String(PyObject *unicode)
14711473

14721474
Return a Python string using the UTF-32 encoding in native byte order. The
14731475
string always starts with a BOM mark. Error handling is "strict". Return
14741476
*NULL* if an exception was raised by the codec.
14751477

1478+
.. versionadded:: 2.6
1479+
1480+
14761481
These are the UTF-16 codec APIs:
14771482

14781483
.. % --- UTF-16 Codecs ------------------------------------------------------ */

Lib/encodings/utf_32.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def decode(self, input, errors='strict'):
125125
if byteorder == -1:
126126
self.decode = codecs.utf_32_le_decode
127127
elif byteorder == 1:
128-
self.decode = codecs.utf_32_le_decode
128+
self.decode = codecs.utf_32_be_decode
129129
elif consumed>=4:
130130
raise UnicodeError,"UTF-32 stream does not start with BOM"
131131
return (object, consumed)

0 commit comments

Comments
 (0)