X Tutup
Skip to content

Commit 90bf5f1

Browse files
committed
Remove mention of narrow/wide builds and update array doc, add a test.
1 parent 199786b commit 90bf5f1

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

Doc/library/array.rst

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ defined:
2121
+-----------+--------------------+-------------------+-----------------------+-------+
2222
| ``'B'`` | unsigned char | int | 1 | |
2323
+-----------+--------------------+-------------------+-----------------------+-------+
24-
| ``'u'`` | Py_UNICODE | Unicode character | 2 | \(1) |
24+
| ``'u'`` | Py_UCS4 | Unicode character | 4 | |
2525
+-----------+--------------------+-------------------+-----------------------+-------+
2626
| ``'h'`` | signed short | int | 2 | |
2727
+-----------+--------------------+-------------------+-----------------------+-------+
@@ -35,9 +35,9 @@ defined:
3535
+-----------+--------------------+-------------------+-----------------------+-------+
3636
| ``'L'`` | unsigned long | int | 4 | |
3737
+-----------+--------------------+-------------------+-----------------------+-------+
38-
| ``'q'`` | signed long long | int | 8 | \(2) |
38+
| ``'q'`` | signed long long | int | 8 | \(1) |
3939
+-----------+--------------------+-------------------+-----------------------+-------+
40-
| ``'Q'`` | unsigned long long | int | 8 | \(2) |
40+
| ``'Q'`` | unsigned long long | int | 8 | \(1) |
4141
+-----------+--------------------+-------------------+-----------------------+-------+
4242
| ``'f'`` | float | float | 4 | |
4343
+-----------+--------------------+-------------------+-----------------------+-------+
@@ -47,10 +47,6 @@ defined:
4747
Notes:
4848

4949
(1)
50-
The ``'u'`` type code corresponds to Python's unicode character. On narrow
51-
Unicode builds this is 2-bytes, on wide builds this is 4-bytes.
52-
53-
(2)
5450
The ``'q'`` and ``'Q'`` type codes are available only if
5551
the platform C compiler used to build Python supports C :c:type:`long long`,
5652
or, on Windows, :c:type:`__int64`.

Lib/test/test_array.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ class UnicodeTest(StringTest):
10151015
smallerexample = '\x01\u263a\x00\ufefe'
10161016
biggerexample = '\x01\u263a\x01\ufeff'
10171017
outside = str('\x33')
1018-
minitemsize = 2
1018+
minitemsize = 4
10191019

10201020
def test_unicode(self):
10211021
self.assertRaises(TypeError, array.array, 'b', 'foo')
@@ -1027,6 +1027,7 @@ def test_unicode(self):
10271027
a.fromunicode('\x11abc\xff\u1234')
10281028
s = a.tounicode()
10291029
self.assertEqual(s, '\xa0\xc2\u1234 \x11abc\xff\u1234')
1030+
self.assertEqual(a.itemsize, 4)
10301031

10311032
s = '\x00="\'a\\b\x80\xff\u0000\u0001\u1234'
10321033
a = array.array('u', s)

Modules/arraymodule.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2593,7 +2593,7 @@ is a single character. The following type codes are defined:\n\
25932593
Type code C Type Minimum size in bytes \n\
25942594
'b' signed integer 1 \n\
25952595
'B' unsigned integer 1 \n\
2596-
'u' Unicode character 2 (see note) \n\
2596+
'u' Unicode character 4 \n\
25972597
'h' signed integer 2 \n\
25982598
'H' unsigned integer 2 \n\
25992599
'i' signed integer 2 \n\
@@ -2605,9 +2605,6 @@ is a single character. The following type codes are defined:\n\
26052605
'f' floating point 4 \n\
26062606
'd' floating point 8 \n\
26072607
\n\
2608-
NOTE: The 'u' type code corresponds to Python's unicode character. On \n\
2609-
narrow builds this is 2-bytes on wide builds this is 4-bytes.\n\
2610-
\n\
26112608
NOTE: The 'q' and 'Q' type codes are only available if the platform \n\
26122609
C compiler used to build Python supports 'long long', or, on Windows, \n\
26132610
'__int64'.\n\

0 commit comments

Comments
 (0)
X Tutup