From fab94a1ccf69c76aaf95b623e6cd7529ca4f826f Mon Sep 17 00:00:00 2001 From: Daniel Lombardi Date: Thu, 4 Jan 2024 14:03:11 -0300 Subject: [PATCH 1/3] gh-110383: Added explanation about array -- data type sizes based on GNU documentation Signed-off-by: Daniel Lombardi --- Doc/library/array.rst | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Doc/library/array.rst b/Doc/library/array.rst index ad622627724217..1e86fec154305f 100644 --- a/Doc/library/array.rst +++ b/Doc/library/array.rst @@ -30,17 +30,17 @@ defined: +-----------+--------------------+-------------------+-----------------------+-------+ | ``'H'`` | unsigned short | int | 2 | | +-----------+--------------------+-------------------+-----------------------+-------+ -| ``'i'`` | signed int | int | 2 | | +| ``'i'`` | signed int | int | 2 | \(2) | +-----------+--------------------+-------------------+-----------------------+-------+ -| ``'I'`` | unsigned int | int | 2 | | +| ``'I'`` | unsigned int | int | 2 | \(2) | +-----------+--------------------+-------------------+-----------------------+-------+ -| ``'l'`` | signed long | int | 4 | | +| ``'l'`` | signed long | int | 4 | \(2) | +-----------+--------------------+-------------------+-----------------------+-------+ -| ``'L'`` | unsigned long | int | 4 | | +| ``'L'`` | unsigned long | int | 4 | \(2) | +-----------+--------------------+-------------------+-----------------------+-------+ -| ``'q'`` | signed long long | int | 8 | | +| ``'q'`` | signed long long | int | 8 | \(2) | +-----------+--------------------+-------------------+-----------------------+-------+ -| ``'Q'`` | unsigned long long | int | 8 | | +| ``'Q'`` | unsigned long long | int | 8 | \(2) | +-----------+--------------------+-------------------+-----------------------+-------+ | ``'f'`` | float | float | 4 | | +-----------+--------------------+-------------------+-----------------------+-------+ @@ -60,6 +60,13 @@ Notes: .. deprecated-removed:: 3.3 3.16 Please migrate to ``'w'`` typecode. +(2) + Int data types (signed or unsigned) can be 16 or 32 bits depending on the platform. The + same way that long data types can be 32 or 64 bits depending on the platform. On most + machines that run GNU C Library, an int is a 32-bit quantity. On most machines, long + int is also 32-bit, the same size as int. And lastly, on most machines, long long int + are 64-bit quantities. View more at: https://www.gnu.org/software/libc/manual/html_node/Range-of-Type.html + The actual representation of values is determined by the machine architecture (strictly speaking, by the C implementation). The actual size can be accessed From eb1b5b3096654a410b12744a3c8ed003a4ff3d07 Mon Sep 17 00:00:00 2001 From: Daniel Lombardi Date: Sat, 20 Jan 2024 18:15:06 -0300 Subject: [PATCH 2/3] fix trailing whitespace lint Signed-off-by: Daniel Lombardi --- Doc/library/array.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/array.rst b/Doc/library/array.rst index 1e86fec154305f..145261143981ab 100644 --- a/Doc/library/array.rst +++ b/Doc/library/array.rst @@ -63,8 +63,8 @@ Notes: (2) Int data types (signed or unsigned) can be 16 or 32 bits depending on the platform. The same way that long data types can be 32 or 64 bits depending on the platform. On most - machines that run GNU C Library, an int is a 32-bit quantity. On most machines, long - int is also 32-bit, the same size as int. And lastly, on most machines, long long int + machines that run GNU C Library, an int is a 32-bit quantity. On most machines, long + int is also 32-bit, the same size as int. And lastly, on most machines, long long int are 64-bit quantities. View more at: https://www.gnu.org/software/libc/manual/html_node/Range-of-Type.html From bf06b75c27aae008190d4dfeb537e0fabe68e96d Mon Sep 17 00:00:00 2001 From: Daniel Lombardi Date: Thu, 14 Mar 2024 11:39:01 -0300 Subject: [PATCH 3/3] Update Doc/library/array.rst Co-authored-by: Terry Jan Reedy --- Doc/library/array.rst | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Doc/library/array.rst b/Doc/library/array.rst index 145261143981ab..042bb5248e9f7c 100644 --- a/Doc/library/array.rst +++ b/Doc/library/array.rst @@ -61,11 +61,7 @@ Notes: Please migrate to ``'w'`` typecode. (2) - Int data types (signed or unsigned) can be 16 or 32 bits depending on the platform. The - same way that long data types can be 32 or 64 bits depending on the platform. On most - machines that run GNU C Library, an int is a 32-bit quantity. On most machines, long - int is also 32-bit, the same size as int. And lastly, on most machines, long long int - are 64-bit quantities. View more at: https://www.gnu.org/software/libc/manual/html_node/Range-of-Type.html + As of 2024, 'h', 'i', 'l', and 'q' are usually 2, 4, 4 on Windows else 8, and 8 bytes. The actual representation of values is determined by the machine architecture