Skip to content

Commit f8def28

Browse files
Issue #17193: Use binary prefixes (KiB, MiB, GiB) for memory units.
1 parent a0eb809 commit f8def28

File tree

9 files changed

+21
-21
lines changed

9 files changed

+21
-21
lines changed

Doc/howto/unicode.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,11 +456,11 @@ with ``bytes.decode(encoding)``. However, the manual approach is not recommende
456456

457457
One problem is the multi-byte nature of encodings; one Unicode character can be
458458
represented by several bytes. If you want to read the file in arbitrary-sized
459-
chunks (say, 1k or 4k), you need to write error-handling code to catch the case
459+
chunks (say, 1024 or 4096 bytes), you need to write error-handling code to catch the case
460460
where only part of the bytes encoding a single Unicode character are read at the
461461
end of a chunk. One solution would be to read the entire file into memory and
462462
then perform the decoding, but that prevents you from working with files that
463-
are extremely large; if you need to read a 2GB file, you need 2GB of RAM.
463+
are extremely large; if you need to read a 2 GiB file, you need 2 GiB of RAM.
464464
(More, really, since for at least a moment you'd need to have both the encoded
465465
string and its Unicode version in memory.)
466466

Doc/library/_thread.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@ It defines the following constants and functions:
9393
Return the thread stack size used when creating new threads. The optional
9494
*size* argument specifies the stack size to be used for subsequently created
9595
threads, and must be 0 (use platform or configured default) or a positive
96-
integer value of at least 32,768 (32kB). If changing the thread stack size is
96+
integer value of at least 32,768 (32 KiB). If changing the thread stack size is
9797
unsupported, a :exc:`RuntimeError` is raised. If the specified stack size is
98-
invalid, a :exc:`ValueError` is raised and the stack size is unmodified. 32kB
98+
invalid, a :exc:`ValueError` is raised and the stack size is unmodified. 32 KiB
9999
is currently the minimum supported stack size value to guarantee sufficient
100100
stack space for the interpreter itself. Note that some platforms may have
101101
particular restrictions on values for the stack size, such as requiring a
102-
minimum stack size > 32kB or requiring allocation in multiples of the system
102+
minimum stack size > 32 KiB or requiring allocation in multiples of the system
103103
memory page size - platform documentation should be referred to for more
104-
information (4kB pages are common; using multiples of 4096 for the stack size is
104+
information (4 KiB pages are common; using multiples of 4096 for the stack size is
105105
the suggested approach in the absence of more specific information).
106106
Availability: Windows, systems with POSIX threads.
107107

Doc/library/lzma.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ Compressing and decompressing data in memory
158158
In addition to being more CPU-intensive, compression with higher presets
159159
also requires much more memory (and produces output that needs more memory
160160
to decompress). With preset ``9`` for example, the overhead for an
161-
:class:`LZMACompressor` object can be as high as 800MiB. For this reason,
161+
:class:`LZMACompressor` object can be as high as 800 MiB. For this reason,
162162
it is generally best to stick with the default preset.
163163

164164
The *filters* argument (if provided) should be a filter chain specifier.
@@ -302,8 +302,8 @@ entries in the dictionary representing the filter):
302302

303303
* ``preset``: A compression preset to use as a source of default values for
304304
options that are not specified explicitly.
305-
* ``dict_size``: Dictionary size in bytes. This should be between 4KiB and
306-
1.5GiB (inclusive).
305+
* ``dict_size``: Dictionary size in bytes. This should be between 4 KiB and
306+
1.5 GiB (inclusive).
307307
* ``lc``: Number of literal context bits.
308308
* ``lp``: Number of literal position bits. The sum ``lc + lp`` must be at
309309
most 4.

Doc/library/os.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2329,7 +2329,7 @@ These functions are all available on Linux only.
23292329
.. data:: XATTR_SIZE_MAX
23302330

23312331
The maximum size the value of an extended attribute can be. Currently, this
2332-
is 64 kilobytes on Linux.
2332+
is 64 KiB on Linux.
23332333

23342334

23352335
.. data:: XATTR_CREATE

Doc/library/posix.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Large File Support
3737
.. sectionauthor:: Steve Clift <[email protected]>
3838

3939
Several operating systems (including AIX, HP-UX, Irix and Solaris) provide
40-
support for files that are larger than 2 GB from a C programming model where
40+
support for files that are larger than 2 GiB from a C programming model where
4141
:c:type:`int` and :c:type:`long` are 32-bit values. This is typically accomplished
4242
by defining the relevant size and offset types as 64-bit values. Such files are
4343
sometimes referred to as :dfn:`large files`.

Doc/library/tarfile.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,11 +669,11 @@ There are three tar formats that can be created with the :mod:`tarfile` module:
669669

670670
* The POSIX.1-1988 ustar format (:const:`USTAR_FORMAT`). It supports filenames
671671
up to a length of at best 256 characters and linknames up to 100 characters. The
672-
maximum file size is 8 gigabytes. This is an old and limited but widely
672+
maximum file size is 8 GiB. This is an old and limited but widely
673673
supported format.
674674

675675
* The GNU tar format (:const:`GNU_FORMAT`). It supports long filenames and
676-
linknames, files bigger than 8 gigabytes and sparse files. It is the de facto
676+
linknames, files bigger than 8 GiB and sparse files. It is the de facto
677677
standard on GNU/Linux systems. :mod:`tarfile` fully supports the GNU tar
678678
extensions for long names, sparse file support is read-only.
679679

Doc/library/threading.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,15 @@ This module defines the following functions:
8080
Return the thread stack size used when creating new threads. The optional
8181
*size* argument specifies the stack size to be used for subsequently created
8282
threads, and must be 0 (use platform or configured default) or a positive
83-
integer value of at least 32,768 (32kB). If changing the thread stack size is
83+
integer value of at least 32,768 (32 KiB). If changing the thread stack size is
8484
unsupported, a :exc:`RuntimeError` is raised. If the specified stack size is
85-
invalid, a :exc:`ValueError` is raised and the stack size is unmodified. 32kB
85+
invalid, a :exc:`ValueError` is raised and the stack size is unmodified. 32 KiB
8686
is currently the minimum supported stack size value to guarantee sufficient
8787
stack space for the interpreter itself. Note that some platforms may have
8888
particular restrictions on values for the stack size, such as requiring a
89-
minimum stack size > 32kB or requiring allocation in multiples of the system
89+
minimum stack size > 32 KiB or requiring allocation in multiples of the system
9090
memory page size - platform documentation should be referred to for more
91-
information (4kB pages are common; using multiples of 4096 for the stack size is
91+
information (4 KiB pages are common; using multiples of 4096 for the stack size is
9292
the suggested approach in the absence of more specific information).
9393
Availability: Windows, systems with POSIX threads.
9494

Doc/library/zipfile.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ defined in `PKZIP Application Note
1818

1919
This module does not currently handle multi-disk ZIP files.
2020
It can handle ZIP files that use the ZIP64 extensions
21-
(that is ZIP files that are more than 4 GByte in size). It supports
21+
(that is ZIP files that are more than 4 GiB in size). It supports
2222
decryption of encrypted files in ZIP archives, but it currently cannot
2323
create an encrypted file. Decryption is extremely slow as it is
2424
implemented in native Python rather than C.
@@ -148,7 +148,7 @@ ZipFile Objects
148148
(:mod:`zlib`, :mod:`bz2` or :mod:`lzma`) is not available, :exc:`RuntimeError`
149149
is also raised. The default is :const:`ZIP_STORED`. If *allowZip64* is
150150
``True`` zipfile will create ZIP files that use the ZIP64 extensions when
151-
the zipfile is larger than 2 GB. If it is false (the default) :mod:`zipfile`
151+
the zipfile is larger than 2 GiB. If it is false (the default) :mod:`zipfile`
152152
will raise an exception when the ZIP file would require ZIP64 extensions.
153153
ZIP64 extensions are disabled by default because the default :program:`zip`
154154
and :program:`unzip` commands on Unix (the InfoZIP utilities) don't support

Modules/_pickle.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1788,7 +1788,7 @@ save_bytes(PicklerObject *self, PyObject *obj)
17881788
}
17891789
else {
17901790
PyErr_SetString(PyExc_OverflowError,
1791-
"cannot serialize a bytes object larger than 4GB");
1791+
"cannot serialize a bytes object larger than 4 GiB");
17921792
return -1; /* string too large */
17931793
}
17941794

@@ -1888,7 +1888,7 @@ save_unicode(PicklerObject *self, PyObject *obj)
18881888
size = PyBytes_GET_SIZE(encoded);
18891889
if (size > 0xffffffffL) {
18901890
PyErr_SetString(PyExc_OverflowError,
1891-
"cannot serialize a string larger than 4GB");
1891+
"cannot serialize a string larger than 4 GiB");
18921892
goto error; /* string too large */
18931893
}
18941894

0 commit comments

Comments
 (0)